Languages can be accessed and changed by either using the name or the code



// Change the Current Language

I2.Loc.LocalizationManager.CurrentLanguage = "English";

I2.Loc.LocalizationManager.CurrentLanguage = "English (Canada)";  //Language and Variant

I2.Loc.LocalizationManager.CurrentLanguage = "English Canada";    //another way of setting it


// or

I2.Loc.LocalizationManager.CurrentLanguageCode = "en";

I2.Loc.LocalizationManager.CurrentLanguageCode = "en-US";

I2.Loc.LocalizationManager.CurrentLanguageCode = "en-CA";



When setting a language without a variant (e.g. "English"), the plugin changes to the first "English" language in the language Source list

(e.g. "English (Canada)")


If a variant is provided, but it can't be found in the languageSource (e.g. setting "English (Canada)" but only "English (United State)" and "English (Australia)" are defined in the LanguageSource), then the plugin strips the variant part, and find the first "English" language in that list.



As an example:


When the LanguageSource has the following languages

   Spanish

   English (United States)

   English (Canada)




I2.Loc.LocalizationManager.CurrentLanguage = "English";                 // sets "English (United States)

I2.Loc.LocalizationManager.CurrentLanguage = "English (Canada)";  // sets "English (Canada)

I2.Loc.LocalizationManager.CurrentLanguage = "English Australia";  // sets "English (United States)

I2.Loc.LocalizationManager.CurrentLanguage = "Chinese";              // doesn't change the language





Language Regions


The plugin also provides easy access to the Language Region/Variant



// When current Language is "English (United States)"

string region = I2.Loc.LocalizationManager.CurrentRegion     // returns "United States"

I2.Loc.LocalizationManager.CurrentRegion = "Canada"     // the new language will be "English (Canada)"


// When current Language Code is "en-US"

string region = I2.Loc.LocalizationManager.CurrentRegionCode     // returns "US"

I2.Loc.LocalizationManager.CurrentRegion = "CA"            // the new language code will be "en-CA"



Created with the Personal Edition of HelpNDoc: Generate Kindle eBooks with ease