1
0
mirror of synced 2024-11-21 20:46:07 +03:00

Start working on translations

This adds a custom r.js build for i18n, which processes each JS
file in the `select2/i18n` directory and builds it.

So far only the "No results found" translation has been added.
This commit is contained in:
Kevin Brown 2014-10-31 22:17:21 -04:00
parent 65875bf8e7
commit 20fcaa4449
4 changed files with 36 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules
dist/js/i18n/build.txt

View File

@ -12,6 +12,24 @@ module.exports = function (grunt) {
'jquery'
].concat(includes);
var i18nModules = [];
var i18nPaths = {};
var i18nFiles = grunt.file.expand({
cwd: 'src/js'
}, 'select2/i18n/*.js');
for (var i = 0; i < i18nFiles.length; i++) {
var file = i18nFiles[i];
var name = file.split('.')[0];
i18nModules.push({
name: name
});
i18nPaths[name] = '../../' + name;
}
grunt.initConfig({
uglify: {
'dist': {
@ -121,6 +139,15 @@ module.exports = function (grunt) {
},
wrap: grunt.file.readJSON('src/js/banner.json')
}
},
'i18n': {
options: {
baseUrl: 'src/js/select2/i18n',
dir: 'dist/js/i18n',
paths: i18nPaths,
modules: i18nModules,
wrap: grunt.file.readJSON('src/js/banner.json')
}
}
},

1
dist/js/i18n/en.js vendored Normal file
View File

@ -0,0 +1 @@
(function(){$&&$.fn&&$.fn.select2&&$.fn.select2.amd&&(define=$.fn.select2.amd.define,require=$.fn.select2.amd.require),define("select2/i18n/en",[],function(){return{no_results:function(){return"No results found"}}}),require("jquery.select2"),$.fn.select2.amd={define:define,require:require}})();

7
src/js/select2/i18n/en.js vendored Normal file
View File

@ -0,0 +1,7 @@
define(function () {
return {
'no_results': function () {
return 'No results found';
}
};
});