diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-03-28 21:04:44 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-03-28 21:04:44 -0700 |
commit | ea43c5f06f5c7242f1d5811fe427e55c87497ecc (patch) | |
tree | 7ee253a40c57c8ea8066305e36b633fa2d7500e4 /modules/gallery/js/l10n_client.js | |
parent | 2eea7b874aa06f08ed58a85197473233b54693aa (diff) | |
parent | e8eb23db42bb929548af358452f1b65e16b61913 (diff) |
Merge branch 'master' of github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/js/l10n_client.js')
-rw-r--r-- | modules/gallery/js/l10n_client.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js index d0d6f619..a1170e2d 100644 --- a/modules/gallery/js/l10n_client.js +++ b/modules/gallery/js/l10n_client.js @@ -124,7 +124,7 @@ jQuery.extend(Gallery, { if (translation[form] == undefined) { translation[form] = ''; } - $('#l10n-edit-plural-translation-' + form) + $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']") .attr('value', translation[form]); $('#plural-' + form).removeClass('hidden'); } @@ -166,7 +166,7 @@ jQuery.extend(Gallery, { if (form == 'one') { text = source['one']; } - $('#l10n-edit-plural-translation-' + form) + $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']") .attr('value', text); } } else { @@ -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'); + translation[form] = $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']").attr('value'); + is_non_empty = 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); @@ -279,7 +287,7 @@ Gallery.behaviors.l10nClient = function(context) { for (var i = 0; i < num_plural_forms; i++) { var form = plural_forms[i]; - $('#g-l10n-client-save-form #l10n-edit-plural-translation-' + form).val(''); + $("#plural-" + form + " textarea[name='l10n-edit-plural-translation-" + form + "']").val(''); } $("#g-l10n-client-save-form input[name='l10n-message-key']").val(''); }, |