Revert "revert incomplete i18n for now"

This reverts commit 86c57da86d9a8a6c30288273af41b5d676b41842.
This commit is contained in:
tg(x) 2016-02-23 14:20:05 +01:00
parent 5591077fe9
commit b9d085b694
2 changed files with 16 additions and 3 deletions

View File

@ -17,10 +17,22 @@
declare var i18n: any;
var i18n = <any>function i18n(strings, ...values) {
// TODO: actually look up translation
return String.raw(strings, ...values);
i18n['init']();
//console.log('i18n:', ...strings, ...values)
return i18n['jed'].translate(strings[0]).fetch(...values);
//return String.raw(strings, ...values);
};
i18n.lang = chrome.i18n.getUILanguage();
i18n.jed = null;
i18n.strings = {};
i18n.init = function() {
if (null == i18n.jed) {
i18n.jed = new window['Jed'] (i18n.strings[i18n.lang]);
}
}
// Interpolate i8nized values with arbitrary objects and
// return array of strings/objects.
i18n.parts = function(strings, ...values) {
@ -35,4 +47,3 @@ i18n.parts = function(strings, ...values) {
return parts;
};

View File

@ -6,7 +6,9 @@
<script src="../lib/vendor/mithril.js"></script>
<script src="../lib/vendor/lodash.core.min.js"></script>
<script src="../lib/vendor/system-csp-production.src.js"></script>
<script src="../lib/vendor/jed.js"></script>
<script src="../lib/i18n.js"></script>
<script src="../lib/i18n-strings.js"></script>
<script src="../lib/module-trampoline.js"></script>
</head>
<body>