-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javascript localization in MVC 5 project #403
Comments
So I found the problem. The i18n module messes with the bundling process of MVC ==> my Javascript files are cached with the old version and if I change the Js files (add nugget, or anything inside,... ), those files will be completely broken, the view cannot find it. I havent checked the source code (of i18n). But had anyone encountered and solved this problem ? |
@marth-santi here is my solution for this issue. I have a global javascript object which accessible from anywhere on client side. On page load it's initialized only with required on particular page translations words. Then in any javascript code I can access translation object and get required translation. Here is my implementation. On server side I have base class for serialization translation objects, as I control which translation goes to the page or control.
This is an example of translation object for specific page
And finally pass it to page which I need to
|
Please help I search all issues but see no one encounter the same problem as mine.
My project is an MVC 5 with some javascript code behind pages, using jquery ajax to navigate to some cshtml partial component.
Localization using Void url scheme in *.cshtml and *.cs is OK, but when I start using nugget inside string in javascript file ==> the web stuck at my home page, with url still has language postfix
../en
or../vn
(behaving like Scheme1), and all elements referred in js file are not displayed / renderedI dont know how to fix this, having tried:
1/ suspect bundle optimization of js files cause problem ==> set
BundleTable.EnableOptimizations = false;
==> no avail2/ follow this issue ##226 ==> change
Script.Render()
like @advantiss suggests ==> no avail3/ Change httpCompression in Web.config (suspecting it to be the problem) ==> no avail too
For more info, the home page still render, but without all elements which got referenced in javascript files
The text was updated successfully, but these errors were encountered: