summaryrefslogtreecommitdiff
path: root/modules/gallery/js
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-07-03 16:14:05 -0700
committerAndy Staudacher <andy.st@gmail.com>2009-07-03 16:14:05 -0700
commita633c134b754305eaa611c5d67af4ca7c79beafe (patch)
treee8949638dbed25a9116e7108fe442a7b7e1df569 /modules/gallery/js
parentfb472da0ba7237b0d9a7a1dde5dd71ff51f87c3b (diff)
Ticket 104: Adding "Copy sourc text" button to l10n UI (usability / productivity improvement)
Diffstat (limited to 'modules/gallery/js')
-rw-r--r--modules/gallery/js/l10n_client.js26
1 files changed, 26 insertions, 0 deletions
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);
+ }
+
+ }
+ }
})
});