0

We have a requirement where the default language code in the url has to be replaced with custom language code. For example www.abcd.com/de should be changed as www.abcd.com/deu. Our sitecore instance is a multisite multilingual setup where we want to do the above change for one particular country-language only. Any suggestions please.

1 Answer 1

0

Sitecore uses System languages when you define a new language in Sitecore.

That is why Step #1: Create a new culture deu and register it in Windows

// This example demonstrates the System.Globalization.Culture-
// AndRegionInfoBuilder Register method.
// Compile this code example with a reference to sysglobl.dll.
// reference to MSDN for custom culture
using System;
using System.Globalization;
using System.Linq;
class Sample
{
    public static void Main()
    {

        //var c = new CultureInfo("deu");
        // cs = CultureInfo.GetCultures(CultureTypes.AllCultures).OrderBy(n => n.EnglishName);

        CultureAndRegionInfoBuilder cib = null;
        try
        {
            Console.WriteLine("Create and explore the CultureAndRegionInfoBuilder...\n");
            cib = new CultureAndRegionInfoBuilder(
                                 "deu", CultureAndRegionModifiers.None);

            // Populate the new CultureAndRegionInfoBuilder object with culture information.
            CultureInfo ci = new CultureInfo("de-DE");
            cib.LoadDataFromCultureInfo(ci);

            // Populate the new CultureAndRegionInfoBuilder object with region information.
            RegionInfo ri = new RegionInfo("DE");
            cib.LoadDataFromRegionInfo(ri);

            // Display some of the properties of the CultureAndRegionInfoBuilder object.
            Console.WriteLine("CultureName:. . . . . . . . . . {0}", cib.CultureName);
            Console.WriteLine("CultureEnglishName: . . . . . . {0}", cib.CultureEnglishName);
            Console.WriteLine("CultureNativeName:. . . . . . . {0}", cib.CultureNativeName);
            Console.WriteLine("GeoId:. . . . . . . . . . . . . {0}", cib.GeoId);
            Console.WriteLine("IsMetric: . . . . . . . . . . . {0}", cib.IsMetric);
            Console.WriteLine("ISOCurrencySymbol:. . . . . . . {0}", cib.ISOCurrencySymbol);
            Console.WriteLine("RegionEnglishName:. . . . . . . {0}", cib.RegionEnglishName);
            Console.WriteLine("RegionName: . . . . . . . . . . {0}", cib.RegionName);
            Console.WriteLine("RegionNativeName: . . . . . . . {0}", cib.RegionNativeName);
            Console.WriteLine("ThreeLetterISOLanguageName: . . {0}", cib.ThreeLetterISOLanguageName);
            Console.WriteLine("ThreeLetterISORegionName: . . . {0}", cib.ThreeLetterISORegionName);
            Console.WriteLine("ThreeLetterWindowsLanguageName: {0}", cib.ThreeLetterWindowsLanguageName);
            Console.WriteLine("ThreeLetterWindowsRegionName: . {0}", cib.ThreeLetterWindowsRegionName);
            Console.WriteLine("TwoLetterISOLanguageName: . . . {0}", cib.TwoLetterISOLanguageName);
            Console.WriteLine("TwoLetterISORegionName: . . . . {0}", cib.TwoLetterISORegionName);
            Console.WriteLine();            
            // Register the custom culture.
            Console.WriteLine("Register the custom culture...");
            cib.CultureEnglishName = "Euro Union";
            cib.CultureEnglishName = "Euro Union";
            cib.Register();

            // Display some of the properties of the custom culture.
            Console.WriteLine("Create and explore the custom culture...\n");
            ci = new CultureInfo("deu");

            Console.WriteLine("Name: . . . . . . . . . . . . . {0}", ci.Name);
            Console.WriteLine("EnglishName:. . . . . . . . . . {0}", ci.EnglishName);
            Console.WriteLine("NativeName: . . . . . . . . . . {0}", ci.NativeName);
            Console.WriteLine("TwoLetterISOLanguageName: . . . {0}", ci.TwoLetterISOLanguageName);
            Console.WriteLine("ThreeLetterISOLanguageName: . . {0}", ci.ThreeLetterISOLanguageName);
            Console.WriteLine("ThreeLetterWindowsLanguageName: {0}", ci.ThreeLetterWindowsLanguageName);

            Console.WriteLine("\nNote:\n" +
                "Use the example in the Unregister method topic to remove the custom culture.");
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }
    }
}

Once the culture is created: Step #2 you should be able to add new language inside Content Editor. Sitecore>System>Languages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.