turquoiseowl / i18n

Smart internationalization for ASP.NET
Other
556 stars 156 forks source link

Ignores set language for js files #228

Closed rickardliljeberg closed 8 years ago

rickardliljeberg commented 8 years ago

I don't know what I can be missing. I have one project set up where all is well.

Then i have this new project where i copied values from the working project. Here are some setup stuff

web.config

<add key="i18n.WhiteList" value="*.cs;*.cshtml;*.js" />

global.asax

i18n.LocalizedApplication.Current.DefaultLanguage = "sv";

// The other project have the top line but i updated i18n now and had to change (no difference with updating project tho)
//i18n.LocalizedApplication.Current.EarlyUrlLocalizerService = null;
i18n.UrlLocalizer.UrlLocalizationScheme = i18n.UrlLocalizationScheme.Void;

i18n.LocalizedApplication.Current.ContentTypesToLocalize = new System.Text.RegularExpressions.Regex("^(?:text/html|text/plain|application/javascript|text/javascript|application/x-javascript|application/json)$");

(there is other web config setup per instructions from github, but not relevant since only js files have problems.)

Now to make this clear.

  1. The new project works with all views and everything, all is translated to swedish (yay)
  2. I only have swedish translations, but i write [[[In english]]]
  3. JS files does remove the [[[ ]]] so they do run through the parser
  4. JS files do not translate into swedish but rather only remove the [[[ ]]]
  5. The other, older projects have exactly same setup code and translate js files just fine.
  6. I first had the same older i18n build for both projects, then updated version for new project, no difference tho.

What am i missing?

turquoiseowl commented 8 years ago

Are the JS files UTF-8?

turquoiseowl commented 8 years ago

Cleared browser cache?

rickardliljeberg commented 8 years ago

Okaaaay i feel silly now.

Right you are at cache, since I only just translated yesterday it had cached with english in it. Silly, but well spotted!

turquoiseowl commented 8 years ago

Well it's partly because i18n is allowing stuff to be cached when perhaps it shouldn't. We're working on this in #226. You're welcome to contribute ideas there.