Add web l10n support
This commit is contained in:
Родитель
d3c9686148
Коммит
22df3879d3
|
@ -35,7 +35,8 @@ var RecroomGenerator = module.exports = function RecroomGenerator(args, options)
|
|||
'@@ember',
|
||||
'@@ember_data',
|
||||
'bower_components/brick/dist/brick.js',
|
||||
'bower_components/localforage/localforage.js'
|
||||
'bower_components/localforage/dist/localforage.js',
|
||||
'scripts/vendor/l10n.js'
|
||||
];
|
||||
};
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -24,6 +24,9 @@
|
|||
<!-- Responsive and mobile friendly stuff -->
|
||||
<meta name="HandheldFriendly" content="True">
|
||||
<meta name="MobileOptimized" content="320">
|
||||
|
||||
<!-- l10n TODO: build step -->
|
||||
<link rel="resource" type="application/l10n" href="l10n/en.properties">
|
||||
</head>
|
||||
|
||||
<!-- Content gets replaced by the application.hbs template. -->
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# Default translation
|
||||
# vim: ft=jproperties
|
||||
|
||||
appTitle = <%= appname %>
|
|
@ -1,12 +1,30 @@
|
|||
FxosUI = window.FxosUI = Ember.Namespace.create()
|
||||
var <%= _.classify(appname) %> = window.<%= _.classify(appname) %> = Ember.Application.create();
|
||||
FxosUI = window.FxosUI = Ember.Namespace.create();
|
||||
|
||||
/* Order and include as you please. */
|
||||
var _ = window.document.webL10n.get;
|
||||
|
||||
require('scripts/controllers/*');
|
||||
require('scripts/store');
|
||||
require('scripts/models/*');
|
||||
require('scripts/routes/*');
|
||||
require('scripts/views/*');
|
||||
require('scripts/router');
|
||||
require('/bower_components/fxos-ui/scripts/components/*');
|
||||
Handlebars.registerHelper('trans', function() {
|
||||
var variables = {};
|
||||
|
||||
if (arguments.length > 1) {
|
||||
for (var i = 1; i <= arguments.length; i += 2) {
|
||||
if (arguments.hasOwnProperty(i)) {
|
||||
variables[arguments[i]] = arguments[i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Handlebars.SafeString(_(arguments[0], variables));
|
||||
});
|
||||
|
||||
window.addEventListener('localized', function() {
|
||||
var <%= _.classify(appname) %> = window.<%= _.classify(appname) %> = Ember.Application.create();
|
||||
|
||||
// Order and include as you please.
|
||||
require('scripts/controllers/*');
|
||||
require('scripts/store');
|
||||
require('scripts/models/*');
|
||||
require('scripts/routes/*');
|
||||
require('scripts/views/*');
|
||||
require('scripts/router');
|
||||
require('/bower_components/fxos-ui/scripts/components/*');
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче