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:
parent
65875bf8e7
commit
20fcaa4449
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
dist/js/i18n/build.txt
|
||||||
|
27
Gruntfile.js
27
Gruntfile.js
@ -12,6 +12,24 @@ module.exports = function (grunt) {
|
|||||||
'jquery'
|
'jquery'
|
||||||
].concat(includes);
|
].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({
|
grunt.initConfig({
|
||||||
uglify: {
|
uglify: {
|
||||||
'dist': {
|
'dist': {
|
||||||
@ -121,6 +139,15 @@ module.exports = function (grunt) {
|
|||||||
},
|
},
|
||||||
wrap: grunt.file.readJSON('src/js/banner.json')
|
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
1
dist/js/i18n/en.js
vendored
Normal 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
7
src/js/select2/i18n/en.js
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
define(function () {
|
||||||
|
return {
|
||||||
|
'no_results': function () {
|
||||||
|
return 'No results found';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user