+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Adding a new language to the language choices

Adding a new language to the language choices

9 posts, 0 answered
  1. James
    James avatar
    6 posts
    Registered:
    06 Aug 2012
    20 Feb 2013
    Link to this post

    How do you Adding a new language to the available language choices? I haven't figured out how to do this. Is this something I have to add directly to the database? (If so where) Is there configuration file or an area in the UI I've missed. I appreciate any support anyone can give. We are running 5.1 sp1

    Specifically we want to implement EN-PR (English puerto rico). We (kind of oddly) don't need SP-PR right now. we'll probably do that in the near future but definitely not right now. We already have an "EN" (which is US) and an EN-CA and FR-CA.

  2. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    20 Feb 2013
    Link to this post

    Hi James,

    In the backend, go to Administration - Setting - Languages. There is no need to touch the database directly. Details can be found here.

  3. James
    James avatar
    6 posts
    Registered:
    06 Aug 2012
    20 Feb 2013 in reply to Arno
    Link to this post
    I saw that. It doesn't indicate how to get a new language added to the list of available languages. We already use 3 different languages but the new one isn't in the list. The page you linked mentions the list is "installed languages". I guess I'm asking how I install a new language as English Puerto Rico isn't listed in the languages or cultures.
  4. Arno
    Arno avatar
    249 posts
    Registered:
    08 Sep 2010
    20 Feb 2013
    Link to this post

    Ok, I see. Well, I don't know then. If you click "Show cultures", the list includes English Carribean, but if that's not what you're looking for, I guess you need help from a real expert from Telerik :-)

  5. James
    James avatar
    6 posts
    Registered:
    06 Aug 2012
    20 Feb 2013 in reply to Arno
    Link to this post
    I do appreciate the help, but yeah could be unless someone else has already done this.
  6. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    06 Dec 2016
    25 Feb 2013
    Link to this post
    Hello,

    The list of cultures in sitefintiy is the list of cultures in .NET, sitefintiy takes all cultures registered in System.Globalization and they can be used for creating multilingual content. Adding more cultures have to be done to the local .NET installation.
    Adding one custom culture is working fine and the newly added custom culture is having LCID (Locale ID) of 4096. This is the LCID for supplemental custom cultured in .NET and its predefined. If you create a custom culture from scratch its ID will be 4096 as .NET used this ID for supplemental custom cultures.
    I have attached a sample for custom culture from scratch and its ID will automatically be 4096 as the properties from CultureInfo don`t have setters (they are read only).

    To run the sample (attached, for creating completely custom culture) and basically working with already created cultures an instance of CultureAndRegionInfoBuilder class is needed which has one part (CultureInfo) in System.Globalization and another part in "sysglobl" assembly, add reference to sysglobl assembly in your project to gain access to CultureAndRegionInfoBuilder.

    As .NET allows you to have only one culture with LCID 4096 the error thrown when second culture is added "An item with the same key already exist" is thrown to indicate this and this is expected based on the above explanation.

    To add more custom cultures a replacement custom cultures have to be created where using the CultureAndRegionInfoBuilder class a specific culture is called by its LCID and modified by using CultureAndRegionModifier set as Replace.
    new CultureAndRegionInfoBuilder("af-ZA",
                  CultureAndRegionModifiers.Replacement);
    Here is a great article explaining this in depth.

    Sitefinity will not limit you in the usage of custom cultures as it will pull all registered cultures in the .NET version installed on the current computer if all the above restrictions are met.

    Regards,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. James
    James avatar
    6 posts
    Registered:
    06 Aug 2012
    25 Feb 2013 in reply to Stanislav Velikov
    Link to this post
    fantastic! now I know what I need to do. Thanks for the response.
  8. James
    James avatar
    6 posts
    Registered:
    06 Aug 2012
    28 Feb 2013
    Link to this post

    I got the new language created easily enough by writing a stand alone console app that more or less copies English US and to English Puerto Rico. This did in fact make the new language-culture combination show up in the cultural list for the adding a language. I added it and got all my language options for each page.

     here's the problem: now when I setup a new page and copy another language that works ok. After I publish the page, if I come back to the page and edit it I get an error. a message box popups saying undefined and the page renders without a publish button. If I uses firebug to watch the network traffic, I see that a request is made that produced a 500 error.

     

    Basically it called this

    http://localhost:60876/Sitefinity/Services/Workflow/WorkflowService.svc/e95e51c4-ded8-4d52-beb5-8df2b2627275/?itemType=Telerik.Sitefinity.Pages.Model.PageNode&itemCulture=en-PR&unv_tstmp_prm=1362090969324 

    and produces this

     {"Detail":"Culture is not supported.\u000d\u000aParameter name: culture\u000d\u000a4096 (0x1000) is an invalid culture identifier."}

     

    it reads like, it doesn't like my new culture I added, is there something else I need to do to make the custom language-culture work?

  9. Serge G
    Serge G avatar
    9 posts
    Registered:
    10 Jun 2011
    26 Dec 2014 in reply to Stanislav Velikov
    Link to this post

    Hello dear Telerik team!

    I just tried the method described above. Using console application and the code provided by Stanislav Velikov (sample attached to his post) I successfully registered new test culture named "tt-TT" in my system. Then problems appeared.

     I selected my new culture in Sitefinity settings and added it to the list of languages for public content, then saved results (changes were correctly saved in ResourcesConfig.config) - and the application immediately stopped to work. I got absolutely no exceptions in browser console, no records in Error.log, no events in system event log. Just infinite loading every time I tried to open any frontend or backend page.

     I used absolutely clean 7.2 project and used the code provided above without any changes. Any ideas what could I do to run my application with custom culture?

9 posts, 0 answered