From a633c134b754305eaa611c5d67af4ca7c79beafe Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Fri, 3 Jul 2009 16:14:05 -0700 Subject: Ticket 104: Adding "Copy sourc text" button to l10n UI (usability / productivity improvement) --- modules/gallery/js/l10n_client.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'modules/gallery/js') diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js index 7e29849d..f5be5058 100644 --- a/modules/gallery/js/l10n_client.js +++ b/modules/gallery/js/l10n_client.js @@ -140,6 +140,32 @@ jQuery.extend(Gallery, { } } } + + this.copySourceText = function() { + var index = Gallery.l10nClient.selected; + if (index >= 0) { + var source = Gallery.l10nClient.getString(index, 'source'); + var is_plural = Gallery.l10nClient.isPluralMessage(source); + if (is_plural) { + if (typeof(translation) != 'object') { + translation = {}; + } + var num_plural_forms = plural_forms.length; + for (var i = 0; i < num_plural_forms; i++) { + var form = plural_forms[i]; + var text = source['other']; + if (form == 'one') { + text = source['one']; + } + $('#l10n-edit-plural-translation-' + form) + .attr('value', text); + } + } else { + $('#l10n-edit-translation').attr('value', source); + } + + } + } }) }); -- cgit v1.2.3