[Pkg-javascript-commits] [pdf.js] 37/161: Makes firefox extension's l10n get() behavior similar to webL10n
David Prévot
taffit at moszumanska.debian.org
Sat Apr 19 14:16:21 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 452e71b4b073b25b3e1c42341a26138016dca476
Author: Yury Delendik <ydelendik at mozilla.com>
Date: Thu Mar 13 17:37:10 2014 -0500
Makes firefox extension's l10n get() behavior similar to webL10n
---
extensions/firefox/tools/l10n.js | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/extensions/firefox/tools/l10n.js b/extensions/firefox/tools/l10n.js
index ff9192b..5474520 100644
--- a/extensions/firefox/tools/l10n.js
+++ b/extensions/firefox/tools/l10n.js
@@ -29,12 +29,21 @@
// translate a string
function translateString(key, args, fallback) {
- var data = getL10nData(key);
- if (!data && fallback)
- data = {textContent: fallback};
- if (!data)
+ var i = key.lastIndexOf('.');
+ var name, property;
+ if (i >= 0) {
+ name = key.substring(0, i);
+ property = key.substring(i + 1);
+ } else {
+ name = key;
+ property = 'textContent';
+ }
+ var data = getL10nData(name);
+ var value = (data && data[property]) || fallback;
+ if (!value) {
return '{{' + key + '}}';
- return substArguments(data.textContent, args);
+ }
+ return substArguments(value, args);
}
// translate an HTML element
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list