Multi Language site problem

Vote:
 

Hi,

We are using Multilanguage site.For Example we have defined start page of the site in Swedish Language(Ex:localhost/sv).We didn't defined the start page in Finninsh language(Ex:localhost/fi).But the page is dispalyed in finnish when we accessed localhost/fi.

What i mean to say is It is possible to display local language on any site/url even though the specific page language version is not loaded in EiServer.

please let me know how to overcome this.

thanks in advance.

#47224
Jan 20, 2011 6:48
Vote:
 

Hi!

There was a bug in EPiServer CMS 5 which I think was fixed in EPiServer CMS 6 that creates a fall back to the master language for the page when doing a direct access to a page in a language that does not exist.

Regards
Linus Ekström

#47234
Jan 20, 2011 9:54
Vote:
 

Hi,

Thanks for your reply.

while creating the page in fallback language(master language)it's rewriting the page language to master language,but the language(epslanguage) in the page URL is not changing to MasterLanguage.Because of this if some particular controls are defined in other language are not converting to this master language.

For example i have a page with Userid..and i accedd the page localhost/lv....when the page is created in master language the control  still fetching the control name from lv language file..because epslanguage in the page URL is still "lv".

I want to convert epslanguage also to Master language when fallback to master happened.Is there any way to do this?

thanks in advance.

#47239
Jan 20, 2011 11:08
Vote:
 

Hi!

Replacement and fallback language are implemented so that they don't change the language context of the loaded page, just the page content.

Check the CurrentPage.LanguageID. This should probablyt reflect the actual language of the page content if fallback/replacement language comes in place. You should never take decisions depending on the incoming url, either check the CurrentPage.LanguageID or the CultureInfo.CurrentCulture property (http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture.aspx).

Regards
Linus Ekström

#47252
Jan 20, 2011 15:55
Vote:
 

Hi Linus,

Thanks for the reply.Now i found the problem.

Actually we are using FriendlyUrlrewrite.Please check the part of the code

  protected override bool ConvertToInternalInternal(UrlBuilder url, ref object internalObject)
        {           
            bool flag;
            if (url == null)
            {
                return false;
            }
        
            if (this.IsVppPath(url, out flag))
            {
                return flag;
            }
            if (!SimpleAddress.SimpleAddressToInternal(url, ref internalObject))
            {
                string str;
                PageReference reference;
                LanguageBranch languageBranchAndPath = GetLanguageBranchAndPath(url.Path, out str);
                if (languageBranchAndPath == null)
                {
                    languageBranchAndPath = LanguageBranch.Load(ContentLanguage.PreferredCulture);
                }
                else
                {
                    ContentLanguage.PreferredCulture = languageBranchAndPath.Culture;
                }

.................................

....................................

  internalObject = page.PageLink;

}

In the above code if i access localhost/lv......in ConvertToInternalInternal  method ..it is taking url.path="/lv/"...because of that languageBranchAndPath is coming for lv language.

Till it is converted to internal URL..we don't know..the page is contained in that particular language.

once after converting to internal url..in this case it is localhoat/default.aspx?....we don't know that particular page is present in that language or not.In this case the page is not present in "lv" language.

but in the above code in the url.path..we used "lv" language.

 

in the above code when i access the URL localhost/lv...if i pass url.path as "/en/" instead of "/lv"...i am getting all the contorls names from xml files also in english...

my requirement is all the control names should also come from "en"(master language)when particular language doesb't exist

so can you advice me in this case.I hope you understood my requirement in this case.

 

 

#47268
Edited, Jan 21, 2011 10:24
Vote:
 

Hi!

I just tested some and you can differ the preffered language and the actual language of the current page like this:

 <%=CurrentPage.LanguageID %>
<%=EPiServer.Globalization.ContentLanguage.PreferredCulture.Name%>

In PageBase there is a virtual method that sets the language settings for the current request:

protected override void InitializeCulture()
        {
            if (IsOptionEnabled(CultureSupport.OptionFlag))
            {
                SystemLanguage.Instance.SetCulture();
                UserInterfaceLanguage.Instance.SetCulture();
            }
        }

You could override this, set the UserInterfaceLanguage to whatever language the CurrentPage property has been loaded with and the labels and the content for CurrentPage should match.

/Linus 

 

#47348
Jan 25, 2011 16:00
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.