Unable to implement localization

Topics: Developer Forum, Project Management Forum, User Forum
Mar 12, 2009 at 1:01 PM
Hi All
  I am new to N2 CMS and i am unable to implement localization in my applcation.Can anyone provide step by step implementation of localization or full solution that has used localization in that.

Thanks & Regards
Abhishek Ranjan
Mar 12, 2009 at 5:16 PM
There at least 4 means of localizing your web application:

1) You have a web page / user control with other web controls inside as a markup and you want to localise their properties. Use a standard ASP.Net implicit localisation feature. There plenty of info on how to do this. (App_LocalResources folder name is your keyword)

2) You want to get a localised strings in code inside your web application. Use a standard ASP.Net explicit localisation feature. (App_GlobalResources folder name to be the anchor)

3) You want a localised resources inside your class library. Use a standard .Net (not specific to the ASP.Net any more!) satellite assemblies with resources. (Pay attention to .resouce files)

These 3 topics were about localising the interface. The remaining one deals with localising a data:

4) You want to localise ContentItems properties of your site. Use the N2 localisation feature. The idea is that N2 automatically keeps a copy of your site hierarchy for every language you want your site to be translated to. So, first you want to create a dedicated StartPage for every language of choice and set it's Language property approprietly. Then, you select any item you want to translate in the Edit interface, click a "globe" icon from the top toolbar and choose a language to translate this item to. N2 will automatically create a copy for your item in appropriate "language site", so that you will be able to edit it's properties in another language. Afterwards, N2 will keep track of versions of items in different languages.

Mar 13, 2009 at 4:58 AM
Thanks for reply.Can you elaborate 4th point where you have mentioned that we have to create dedicated StartPage for every language of choice and set it's Language property approprietly.Do we need to create a start page dynamically or in code behind in VS and how to set language property?I have tried to implement ILanguage in class but only thing i am able to create a new page with option of selecting different dropdown.I am not able to translate it.
Can you provide the code for implementation.That will be helpful for me.

Mar 13, 2009 at 11:10 AM
Well, you should start by creating several StartPages in the Edit interface. If you set a Language property for them, then they'll be treated not as a different sites, but just as a localisation of the same site. You don't need any code -- everything is kept in sync by N2. For extensive example of how it aLL can be done, please rollback any sample data package from the N2.Templates site.
Mar 13, 2009 at 8:59 PM
Hi, did you find this article on globalization in the wiki?
Mar 23, 2009 at 2:18 PM
Thanks for your help.Now i am able to implement the globalization but again the problem is to how to switch between different  language in website as per the method you described.I can do that in edit section of page,but how to do after publishing.
Mar 23, 2009 at 8:25 PM
I suggest you examine the templates pack and more specifically the top menu code: http://code.google.com/p/n2cms/source/browse/trunk/src/wwwroot/Templates/UI/Layouts/TopMenu.ascx.cs