summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-06-09 19:49:06 -0700
committerAndy Staudacher <andy.st@gmail.com>2009-06-09 19:49:06 -0700
commit7ccb65ea9ebf10e35c09bbebf8ffe1118d3fb0fb (patch)
tree21fcd1938a2538f10387fc285db6f084fdad1e66
parentb276eaa68beca1266bf8fd83625ddfad73f44420 (diff)
Fix for fetching l10n plural messages. Need to cast from stdclass to array(), as I18n expects all messages to be either string or array.
-rw-r--r--modules/gallery/helpers/l10n_client.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php
index 33f23857..20f81ecc 100644
--- a/modules/gallery/helpers/l10n_client.php
+++ b/modules/gallery/helpers/l10n_client.php
@@ -123,7 +123,12 @@ class l10n_client_Core {
$key = $message_data->key;
$locale = $message_data->locale;
$revision = $message_data->rev;
- $translation = serialize(json_decode($message_data->translation));
+ $translation = json_decode($message_data->translation);
+ if (!is_string($translation)) {
+ // Normalize stdclass to array
+ $translation = (array) $translation;
+ }
+ $translation = serialize($translation);
// @todo Should we normalize the incoming_translations table into messages(id, key, message)
// and incoming_translations(id, translation, locale, revision)? Or just allow