summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gallery/js/l10n_client.js26
-rw-r--r--modules/gallery/views/l10n_client.html.php2
2 files changed, 28 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);
+ }
+
+ }
+ }
})
});
diff --git a/modules/gallery/views/l10n_client.html.php b/modules/gallery/views/l10n_client.html.php
index 38e92e3e..c0cbbfa2 100644
--- a/modules/gallery/views/l10n_client.html.php
+++ b/modules/gallery/views/l10n_client.html.php
@@ -63,6 +63,8 @@
<?= form::textarea("l10n-edit-plural-translation-other", "", ' rows="2"') ?>
</div>
<input type="submit" name="l10n-edit-save" value="<?= t("Save translation") ?>"/>
+ <a href="javascript: Gallery.l10nClient.copySourceText()"
+ class="gButtonLink ui-state-default ui-corner-all"><?= t("Copy source text") ?></a>
</form>
</div>
</div>