Closed tomasr78 closed 9 years ago
I'm not clear what you mean by 'external JS file'?
My ASP.NET MVC JavaScript code stored on external JS file - myScript.js and I use it in MVC like this
@Scripts.Render("~/bundles/myScript")
bundles.Add(new ScriptBundle("~/bundles/myScript").Include( "~/Scripts/myScript.js" ));
I would say those files are internal to your site. Anyway, the good news is that i18n supports i18n of javascript files like you describe. If it is not working, it could be you're static caching those files, not whitelisting them, filtering them out. Please see the readme for more information. Thanks.
My mistake, I have added *.js to white-list and everything works fine.
It seems external JS files are not translated. My first idea is add all text from external JS file as constant values into _Layout.cshtml, the downside of this that text will not be minified. Just would like to know your opinion what approach would be the best for translating text in external JS files, I am sure you faced this question before while developing i18n. This is actually not an issue of i18n but many developers using i18n may face this problem.