Walter.BOM
GetLanguage Method
Example 
Walter.BOM Assembly > Walter.BOM.Geo Namespace > GeoExtensionMethods Class : GetLanguage Method
The culture information object, identifying a specific culture or country. The culture is identified using the System.Globalization.CultureInfo.Name property, which includes both the language and the country/region.
Attempts to determine the primary language associated with the culture represented by the provided System.Globalization.CultureInfo object.
Syntax
public static GeoLocation GetLanguage( 
   CultureInfo info
)

Parameters

info
The culture information object, identifying a specific culture or country. The culture is identified using the System.Globalization.CultureInfo.Name property, which includes both the language and the country/region.

Return Value

The primary language associated with the specified culture. If the specific culture's primary language cannot be determined, the method attempts to return the official language of the country associated with the culture. If the language still cannot be identified, the method may return a default or an undefined language indicator.
Remarks
This method is useful for applications that need to process or display language-specific content based on the user's cultural context. It leverages the full name of the culture (including both language and region) to ascertain the most appropriate primary language. This can be particularly important in multilingual countries or regions where multiple languages are spoken, but one is predominantly used in cultural or official capacities.
Example
The following example demonstrates how to use the `GetLanguage` method to retrieve the primary language for a specified culture. This can be particularly useful for tailoring application content or functionality to match the user's linguistic preferences. This sample shows how to identify the primary language from a `CultureInfo` object, which can be used to adapt the user interface or content dynamically based on the user's cultural and linguistic context.
// Instantiate a CultureInfo object for French as spoken in France
CultureInfo frenchCultureInfo = new CultureInfo("ch-FR");
            
// Use the GetLanguage method to determine the primary language
var primaryLanguage = frenchCultureInfo.GetLanguage();
            
Console.WriteLine($"The primary language for {frenchCultureInfo.Name} is {primaryLanguage}.");
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GeoExtensionMethods Class
GeoExtensionMethods Members