Display content from another language

Vote:
 
The site I'm working on uses the multilanguage features in 4.5 and available languages are english, swedish and finnish. Not all pages are however translated to finnish, and instead I would like to display the english content in them. However, I would like menus to remain in finnish. From a editor perspective I would like the editor to click the finnish tab for a multilanguage page, type in only the page name and then choose a language from which the content would be fetched. In the codebehind file I would then add: if(!CurrentPage.Property["contentLang"].ToString().Equals("")) { ///Code that fills all properties in a region with those from the specified language } Is this possible, and if so could someone please point me in the right direction regarding how the code above should be?
#12764
Sep 01, 2006 16:31
Vote:
 
Hi. As you may know, in EPiServer version 4.60 the multilanguage support is much better than in the previous versions. If yo uhave the time, plan to do an upgrade and you and the editors will be suprised. We'll back to 4.51. To display the content of another language you have to access the property like this CurrentPage.Property["contentLang___LANGUAGECODE"]. In the previous versjon each langeuage has it's own property with tree underscores (___) and then the langauge code. If you want to check if the property exist and has a value, use the IsValue (see PageBase.IsValue in the SDK). This -> CurrentPage.Property["contentLang"].ToString() will give you an exception if the propertyname is missing or is null. /Øyvind
#14855
Sep 05, 2006 14:35
Vote:
 
Thanks for your response! Looking into 4.60 is definetly something I will do. Is the upgrade free btw? Anyhow, for now I would need to make this work with 4.51. While I'm able to check whether a certain property exists in a language, as described by your post, what I then need to do is load all other properties for which IsPropertyData == true in a different language. For example, the context lang might be set to "FI", but if a certain condition (ie. contentLang exists) is met I want all properties for which IsPropertyData == true to instead be fetched from the swedish version of the same page. I however do not want to change the context lang. Any ideas?
#14856
Sep 08, 2006 16:30
Vote:
 
The upgrade is free if you have included the subscription agreement on your license. You should not use IsPropertyData. If you want to check if the proerpty exists you should us IsValue (see the PageBase.IsValue in the SDK). Check if the property exists and have a value. string pagename = IsValue("PageName___FI") ? CurrentPage["PageName___FI"] : "No pagename in finish"; /Øyvind
#14857
Sep 12, 2006 12:20
Vote:
 
OK, but what if I want to accomplish something like this: if(IsValue("PageName___FI") && !IsValue("SomeTextProp___FI")) { CurrentPage["SomeTextProp___FI"] = CurrentPage["SomeTextProp___EN"]; } Obviously the above code doesn't work, but what I mean is that my main problem still is how to replace _some_ properties in a multilanguage page with the matching properties from another language. I would, so to speak, want to achieve the same effect as changing the epslanguage in httpcontext but only for certain properties, not the entire page.
#14858
Sep 13, 2006 10:59
* 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.