I'm suspecting this change in web.config may have something to do with it:
CMS6:
<globalization culture="en-US" uiCulture="en" requestEncoding="utf-8" responseEncoding="utf-8" resourceProviderFactoryType="EPiServer.Resources.XmlResourceProviderFactory, EPiServer" />
CMS7:
<globalization culture="en-US" uiCulture="en" requestEncoding="utf-8" responseEncoding="utf-8" resourceProviderFactoryType="EPiServer.Framework.Localization.LocalizationServiceResourceProviderFactory, EPiServer.Framework" />
Hi, Oerjan,
The setting in web.config is correct.
How do you translate? Do you use LocalizationService.Current.GetString("/xx/yy")?
Hi,
I've tried both LocalizationService.Current.GetString("/xx/yy") and the obsolete way LanguageManager.Instance.Translate("/xx/yy").
If I understand your problem correctly, this is bug #95725
http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=71948
Alf:
Yes, it fits my description, except for this part: "When browing in View mode (outside EPiServer UI) everything seems ok, I can switch language by browsing with different language prefix in the url exactly like everything is supposed to behave."
In that case, I guess my translations should have been displayed just fine when I'm viewing the page not-logged in?
Yes, that's correct. I only had this problem when I'm in Edit mode. While in View mode/not logged in I had no problems at all.
Could you check what preferred language you're on when browsing?
When debugging, I see that CultureInfo.CurrentUICulture is "en" when it should have been norwegian "no".
ContentLanguage.PreferredCulture however, is "no".
Same problem here Ørjan. Solution is EPiServer 7.1 with two languages, Norwegian and English. On English pages all of the lang text is in Norwegian.
When on "/en" page following happens:
<% = CultureInfo.CurrentUICulture.DisplayName %>
shows Norwegian
<%= CurrentPage.Language.DisplayName %>
shows English
According to EPiServer support "CultureInfo.CurrentUICulture" is used in all of the following:
<EPiServer:Translate Text="/bw/usercontrols/logIn/mypage" runat="server" />
<%= LocalizationService.Current.GetString("/bw/usercontrols/logIn/mypage") %>
<%= Translate("/bw/usercontrols/logIn/mypage") %>
This one works however, but shouldn't be necessary:
<%=LocalizationService.Current.GetStringByCulture("/bw/usercontrols/logIn/mypage", CurrentPage.Language)%>
One more thing is that Translate seems to work only for one language at a time. Changing configuration from
<globalization culture="nb-NO" uiCulture="no"
to
<globalization culture="en-US" uiCulture="en"
shows lang text in English on both "/en" and "/no" pages.
I'm in dialog with EPiServer support, and will post any new findings here.
This did it for me!
Fix for Webforms is to make all UserControls inherit from SiteUserControl<SitePageData> and all templates fromSiteTemplatePage<SitePageData>. You can then simply set CurrentUICulture inside constructor for SitePageData:
public class SitePageData : PageData
{
public SitePageData()
{
if (ContentLanguage.PreferredCulture.LCID != Thread.CurrentThread.CurrentUICulture.LCID)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(ContentLanguage.PreferredCulture.LCID);
}
}
}
Fixfor Mvc is to make all of your Controllers inherit from BasePageController and add following override:
protected override IAsyncResult BeginExecute(System.Web.Routing.RequestContext requestContext, AsyncCallback callback, object state)
{
if (ContentLanguage.PreferredCulture.LCID != Thread.CurrentThread.CurrentUICulture.LCID)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(ContentLanguage.PreferredCulture.LCID);
}
}
Small adjustment for Webforms projects. Adding following code to SiteMasterPage which all of the other masterpages inherit from did the trick for me.
protected void Page_Init(object sender, EventArgs e)
{
if (ContentLanguage.PreferredCulture.LCID != Thread.CurrentThread.CurrentUICulture.LCID)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(ContentLanguage.PreferredCulture.LCID);
}
}
I have an issue with a globalized multi-site always showing english XML texts - regardless of what site language is set.
This happened after the upgrade to 7. I have installed all of the latest patches for 7.
Any ideas?