Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • lillewox 2 posts 20 karma points
    Apr 14, 2009 @ 15:48
    lillewox
    0

    Umbraco 401. Globalization, Culture and Translations

    I downloaded my first copy of Umbraco one week ago, and started of by examine the membership, role and profile providers. After installing some packages and depolying my new controls for navigation and login etc, I´m now exploring the globalization, language and dictionary features. There was no problem accessing the translations and dictionary from my controls but I had some issues with the translation of content based on Culture for pagetypes.

    If there is a property in a pagetype called BodyText I want to create a tab for each language to make it possible for the editor to quick and easy insert and publish content on supported languages. The "

    Where is the default UICulture set in Umbraco and how is the idea of multilingual sites implemented? Has anyone been trying to extend the Item class?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Apr 14, 2009 @ 22:15
    Morten Bock
    0

    To most widely used way of creating multi language sites is using separate tree structures:

    Content
    - en
    - - some English page
    - da
    - - some Danish page

    In this scenario, the pages properties do not need localized version, because the languages are separate pages.

    In your scenario, you would probably need to create properties for each language, so you would have "BodyTextEN" and "BodyTextDA" properties. Then you would have to build some logic in your template/macro to determine which properties to display, based on f.ex. dictionary items, or by detecting which culture umbraco has determined. So it will take a bit of tweaking to get it working well, and would require that you have every single page in all languages, unless you of course build logic to handle that as well.

    How are you planning for your URL's to differ between language versions? da.example.com or www.example.com/da ?

  • nickspacek 26 posts 20 karma points
    Apr 16, 2009 @ 20:03
    nickspacek
    0

    How do you detect/set which culture Umbraco detects? I am using the 1-1 Multilingual solution, and as far as I can tell inserting a dictionary field into a template is [del]useless[/del]. :) I can localize the XSLT objects fine using the sample code given in the tutorial, but I haven't figured out how to localize the dictionary fields in the templates.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Apr 16, 2009 @ 20:24
    Morten Bock
    0

    Umbraco uses hostnames to determine the culture. For example:

    Content
    - Home (Assign hostnames here)
    - - About us
    - - Contact

    Right click on the Home node at select "manage hostnames". Then you add the different domains/cultures you want to use, for example www.example.com, en.example.com and da.example.com. (Add cultures under Setttings -> Languages).

    Now when you access da.example.com/about-us.aspx umbraco will automatically detect that the dictionary items fetched should be in danish. So all you have to do is insert your dictionary item in the template:



    Are you planning to use different domains for your languages? This is pretty important as to which approach you should take to the multi language site, and it would be easier to help you further.

  • lillewox 2 posts 20 karma points
    Apr 17, 2009 @ 08:41
    lillewox
    0

    Hi All. Thans for your input. As described in my first message I have properties for every language the application supports. I´m now using a hierarchy model to determine culture.

    scenario 1: (not authenticated)
    - client browsers tools/languages, and first priority in there.

    scenario 2: (authenticated)
    - look at the client profile settings about language
    - profile missing: client browsers tools/languages, and first priority in there.

    If current culture is missing I will use the default fallback culture for example (en-US) etc.

    I created a usercontrol that reads the current languages culture instead of using the

    Here is a litte snippet from my new control:
    public string PropertyAlias { get; set; }

    protected void PageLoad(object sender, EventArgs e)
    {
    PropertyValue.Text = GetCurrentPropertyValue(PropertyAlias).ToString(); //bodyText
    sv-SE
    }



    here is a littele snippet that sets the culture:

    [color=green]global.asax
    protected void Application_AcquireRequestState(object sender, EventArgs e)
    {
    if (!Profile.IsAnonymous) //check if is authenticated
    {
    if (!string.IsNullOrEmpty(Profile.Culture)) //check if Culture is set
    SetCulture(Profile.Culture); //culture from profile
    else
    SetCulture(this.Request.UserLanguages[0]); //culture from browsers first culture
    }
    else //if not authenticated
    {
    SetCulture(this.Request.UserLanguages[0]); //culture from browsers first culture
    }
    }

    private void SetCulture(string culture)
    {
    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture);
    System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(culture);
    }[/color]

    ----

    With this approach I can use all login controls translated by the current culture settings. And use umbraco translations (dictionary) for all words.

    Any comments to this?

  • nickspacek 26 posts 20 karma points
    Apr 17, 2009 @ 13:12
    nickspacek
    0

    I'll take a look at the way you're doing it lillewox. I would like to say that having that as the only built-in method of culture determination seems pretty restrictive! :)

    Nick

Please Sign in or register to post replies

Write your reply to:

Draft