Default page localization problem

Topics: Localization
Nov 16, 2012 at 8:13 PM
Edited Nov 19, 2012 at 2:19 PM

Hello,

I have 2 languages Orchard site (Orchard 1.6) . I'm using CulturePicker to change current culture. 

I have localized content.

I have default page / in english, then i created translation of that page in lt-Lt culture. When I've created translation of the main page, I had to set different permalink to that page for example /pageLt.

Default langue for the site is english. When I start it , everything works fine, content switched between languages, everything is ok.  BUT. If it swich lt-Lt (cookie is set and saved to lt-Lt culture) and I i try entering main URL http://server/Orchard/ i get empty page. No content at all. I have all my widgets in the default layer, I tried adding widgets in home page layer, but any content is shown only in english culture, If i set to lt-Lt - default page is completely empty. 

What I'm doing wrong? 

 

Thanks

Nov 21, 2012 at 5:14 PM

Hi, I actually have the same problem.  I think it may be a problem with the culture picker module and compatibility with Orchard 1.6.  I had tried the module with 1.5.1 and it worked fine, I think it may be a problem with the "Home Page Auto Redirect" part of that module.

Also one thing I noticed is the main menu seems to be automatically filtered in Orchard 1.6 for culture.  I disabled the menu filtering part of the culture picker module, and my main navigation is still filtered.

I'm testing many of the aspects of localization, if I find a solution to the home page redirect, I will post another message.

Nov 22, 2012 at 6:04 AM

Hi,

i agree with you that the problem is with culture picker and orchard v 1.6. 

I have managed to make dirty work around :) What i did is: in LocalizableHomeController.cs method  public ActionResult Index()  i 

changed 

if (_localizableContentService.TryFindLocalizedRoute(content, currentCultureName, out localizedRoutePart)) {
                return this.RedirectLocal(localizedRoutePart.Path, (Func<ActionResult>) null);            }

to

if (_localizableContentService.TryFindLocalizedRoute(content, currentCultureName, out localizedRoutePart)) {
                string str = "/OrchardLocal/"+localizedRoutePart.Path;               
return this.RedirectLocal(str, (Func<ActionResult>) null);            }

and in the public ActionResult ChangeCulture method in UserCultureController.cs i made same changes:

 SaveCultureCookie(cultureName);            
returnUrl = "/OrchardLocal/" + returnUrl;          
return this.RedirectLocal(returnUrl);

this is ugly but it works for now :)

Dec 1, 2012 at 3:06 PM
Liutauras wrote:

Hi,

i agree with you that the problem is with culture picker and orchard v 1.6. 

I have managed to make dirty work around :) What i did is: in LocalizableHomeController.cs method  public ActionResult Index()  i 

changed 

if (_localizableContentService.TryFindLocalizedRoute(content, currentCultureName, out localizedRoutePart)) {
                return this.RedirectLocal(localizedRoutePart.Path, (Func<ActionResult>) null);            }

to

if (_localizableContentService.TryFindLocalizedRoute(content, currentCultureName, out localizedRoutePart)) {
                string str = "/OrchardLocal/"+localizedRoutePart.Path;               
return this.RedirectLocal(str, (Func<ActionResult>) null);            }

and in the public ActionResult ChangeCulture method in UserCultureController.cs i made same changes:

 SaveCultureCookie(cultureName);            
returnUrl = "/OrchardLocal/" + returnUrl;          
return this.RedirectLocal(returnUrl);

this is ugly but it works for now :)

I experience the same problem when I switch between content.

It seems like _localizableContentService.TryFindLocalizedRoute finds the correct route, but the RedirectToLocal returns "~/" when it's mall-formed url e.g, "abcdef".

A better fix than to hardcode "OrchardLocal", which is mostly not correct except when you debug the source code is to:

return this.RedirectLocal("~/" +Url.Encode(returnUrl));  

(Line 41 in UserCultureController.cs) 

That way you will be redirected to the correct virtual path of the web application.

Dec 2, 2012 at 10:32 AM

Hi all,

I've created an issue: http://orchardculturepicker.codeplex.com/workitem/33.

Plan to fix it today. Stay tuned :)

Dec 3, 2012 at 6:32 AM

Thanks! J

Liutauras Lipavičius

IT skyriaus vadovas

M. +370 686 83080

From: ermakovich [email removed]
Sent: Sunday, December 2, 2012 12:33 PM
To: Liutauras Lipavičius
Subject: Re: Default page localization problem [orchard:403535]

From: ermakovich

Hi all,

I've created an issue: http://orchardculturepicker.codeplex.com/workitem/33.

Plan to fix it today. Stay tuned :)