diff --git a/.gitignore b/.gitignore index 3c3629e6..163c732b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +dist/js/i18n/build.txt diff --git a/Gruntfile.js b/Gruntfile.js index b47d6d57..6782576f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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') + } } }, diff --git a/dist/js/i18n/en.js b/dist/js/i18n/en.js new file mode 100644 index 00000000..0250e6c9 --- /dev/null +++ b/dist/js/i18n/en.js @@ -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}})(); \ No newline at end of file diff --git a/src/js/select2/i18n/en.js b/src/js/select2/i18n/en.js new file mode 100644 index 00000000..3fbfe9df --- /dev/null +++ b/src/js/select2/i18n/en.js @@ -0,0 +1,7 @@ +define(function () { + return { + 'no_results': function () { + return 'No results found'; + } + }; +});