Internationalization and localization tools


Windows C++ Locale Function

int GetGeoInfo(GEOID GeoId, GEOTYPE GeoType, LPTSTR lpGeoData, int cchData, LANGID language);

int GetGeoInfoA(GEOID GeoId, GEOTYPE GeoType, LPSTR lpGeoData, int cchData, LANGID language);

int GetGeoInfoW(GEOID GeoId, GEOTYPE GeoType, LPWSTR lpGeoData, int cchData, LANGID language);

Internationalization (I18n) Function Overview

The GetGeoInfo function retrieves GeoType information about the location GeoId, in the language specified by language, and stores the result in the buffer pointed to by lpGeoData. If cchData is non-zero, then it specifies the size, in TCHARs, of the lpGeoData buffer, and the return will be the number of TCHARs written to the buffer. If cchData is 0, then GetGeoInfo will return the number of TCHARs required to hold the information, including the null terminator, but will not store the data.

If language is NULL, then the returned information will be in the system's default UI language.

GetGeoInfoA is the narrow version of the function, storing a single or multibyte character string in the buffer pointed to be lpGeoData, and where cchData and the return value are single-byte length values.

GetGeoInfoW is the wide version of the function, storing a wide-character string in the buffer pointed to be lpGeoData, and where cchData and the return value are wide-character (WCHAR) length values.

See the MSDN Library for additional information.

I18n Issues

Use the appropriate version of the function as required for internationalization support, noting the following:

Formulate the correct language id to pass into GetGeoInfo; do not pass in NULL for the language, as in an internationalized application, the program's language may differ from the system's language.

Ensure that cchData is correct for the chosen platform; bytes for the narrow version and WCHARs for the wide version. See Locale-Sensitive Length Functions for a discussion on multibyte and wide character sizes.

Note that GetGeoInfo is supported only on Windows XP, Windows Server 2003, and Windows Me.

Recommended Replacements*

When possible, use the Generic version of the function, rather than the narrow or wide versions, and let the Windows #define UNICODE switch determine which version of the function will be called.

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

Windows C++ Locale Functions

 

Lingoport internationalization and localization services and software