Fix for fetching l10n plural messages. Need to cast from stdclass to array(), as I18n expects all messages to be either string or array.

This commit is contained in:
Andy Staudacher
2009-06-09 19:49:06 -07:00
parent b276eaa68b
commit 7ccb65ea9e

View File

@@ -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