diff options
author | Andy Staudacher <andy.st@gmail.com> | 2010-02-27 19:13:22 -0800 |
---|---|---|
committer | Andy Staudacher <andy.st@gmail.com> | 2010-02-27 19:13:22 -0800 |
commit | 8366f58ef9621679600ae0862cf72418d3e6f6fd (patch) | |
tree | 668d7039b2e4db4c5ab18238646f04441e447f7c /modules/gallery/js | |
parent | 48193371e4a1fc315a5f24986dbdad002270e061 (diff) |
Client (UI) side fix for ticket #1042, based on a patch from fpaterno (Florent Paterno). Mark message as untranslated if the translation is empty.
Diffstat (limited to 'modules/gallery/js')
-rw-r--r-- | modules/gallery/js/l10n_client.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js index d0d6f619..c9009d97 100644 --- a/modules/gallery/js/l10n_client.js +++ b/modules/gallery/js/l10n_client.js @@ -260,18 +260,26 @@ Gallery.behaviors.l10nClient = function(context) { // Store translation in local js var translation = {}; + var is_non_empty = false; if (is_plural) { for (var i = 0; i < num_plural_forms; i++) { var form = plural_forms[i]; translation[form] = $('#g-l10n-client-save-form #l10n-edit-plural-translation-' + form).attr('value'); + is_non_empty |= translation[form]; } } else { translation = $('#l10n-edit-translation').attr('value'); + is_non_empty = translation; } Gallery.l10nClient.setString(Gallery.l10nClient.selected, translation); - // Mark message as translated. - $('#l10n-client-string-select li').eq(Gallery.l10nClient.selected).removeClass('untranslated').removeClass('active').addClass('translated'); + // Mark message as translated / untranslated. + var source_element = $('#l10n-client-string-select li').eq(Gallery.l10nClient.selected); + if (is_non_empty) { + source_element.removeClass('untranslated').removeClass('active').addClass('translated'); + } else { + source_element.removeClass('active').removeClass('translated').addClass('untranslated'); + } // Clear the translation form fields Gallery.l10nClient.showSourceMessage('', false); |