vtfuture / BForms

Bootstrap Forms for ASP.NET MVC
MIT License
62 stars 33 forks source link

i18n does not work after upgrading RequireJS to v2 #194

Closed jaimestuardo closed 9 years ago

jaimestuardo commented 9 years ago

Hello, I have upagraded ia NuGet RequireJS. After that, I had to make a lot of changed, after finally I could get it work, however, I have problems with internationalization.

These erors appears in browser:

  "NetworkError: 404 Not Found - http://localhost:16166/Scripts/validate-es.js"

validate-es.js "NetworkError: 404 Not Found - http://localhost:16166/Scripts/select2-es.js"

I searched and I found this code in bforms.initUI.js :+1: if (uiLocale != 'en' && typeof uiLocale !== "undefined") { //load external i18n files var localeDeferred = $.Deferred(); this.deferredList.push(localeDeferred); require([ 'validate-' + uiLocale, 'select2-' + uiLocale ], function () { localeDeferred.resolve(); }); }

Maybe bforms.initUI.js is not prepared for RequireJS.net v2? How to fix either bforms.initUI.js or configuration files to allow bforms internationalization?

mariuscosareanu commented 9 years ago

Hello, you are supposed to add a new path in the RequireJs.config and the RequireJs.Release.config files, pointing to your i18n script. In your case, it should look something like this: <path key="validate-es" value="path to the es i18n script" /> for the deprecated xml configuration, or like this : "validate-es" : "path to the es i18n script" if you are using the json config file.

Edit : you should also add a path for the select2 i18n script, looking like this "select2-es": "path to select2 es i18n script"