How to create a module in a website with 3 front-end languages? - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

How to create a module in a website with 3 front-end languages?

  • How to create a module in a website with 3 front-end languages?
  • My resources are defined as the following:

    <cultures>
        <clear />
        <add culture="en-US" uiCulture="en" key="english-en-us" />
        <add culture="pt-BR" uiCulture="pt" key="portuguese-pt-br" />
        <add culture="es-ES" uiCulture="es" key="spanish-es-es" />
    </cultures>
    <backendCultures>
        <clear />
        <add culture="en-US" uiCulture="en" key="english-en-us" />
    </backendCultures>

    I've create a ApplicationModule using SitefinityModule template that comes with the installation. It does appear on /Sitefinity/Administration/Settings/Advanced > System > ApplicationModules.

    I've configured it to install "OnApplicationStart", but I always get that error in this line:

    sf.DocumentLibrary().CreateNew().Do(lib =>
        lib.Title = ModuleName;     // ERROR
        lib.UrlName = ModuleName;
    );

    lib language is setted as "pt-BR", but my backend is not in portuguese, it is only in english.

    Unsupported language "pt-BR". If you want to support this language, please configure your application accordingly.

    My SO is Windows 7 pt-BR.

    How exactly does it work? What should I do to build a module that can work in any language?


    ---
    Forcing to en-US

    System.Threading.Thread.CurrentThread.CurrentCulture =
                        System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

    Showed the same error, but for en-US.

    Checking for

    moduleNode.AvailableLanguages

    Shows that it is empty.

    How do I configure these languages?

    --------------

    This only happens when I have more than one front-end language.
  • Hello Bruno Michels,

    This has been logged as a bug. It is related to a problem that in multilingual mode Sitefinity doesn't set correctly the current UI culture during the installation of Modules. 
    As a workaround i propose to change the beginning of your module install method like this:

    public override void Install(SiteInitializer initializer)
        base.Install(initializer);
        if (Config.Get<ResourcesConfig>().Multilingual)
        
            System.Threading.Thread.CurrentThread.CurrentUICulture        =     CultureInfo.GetCultureInfo    (Config.Get<ResourcesConfig>().DefaultBackendCulture.UICulture);
         

    Anyway this bug will be fixed for SP1 that will be releasing this week.

    All the best,
    Pavel
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!