Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

ILocale

The ILocale interface provides language-specific string formatting patterns, formatting logic, and comparison logic for a single language. All string formatting and comparison logic for a language should be stored within a single ILocale object.

Each ILocale implementation registers itself as a mimetype handler in its MIF. ILocale objects handle "text/plain;xxxx", where "xxxx" is a four character language code. This code consists of the ISO 639-1 language code (2 characters) followed by the ISO 3166 A2 country code (2 characters). If no country code is needed to specify the language (Korean, for example), two spaces are used in place of the country code. For example, "enus" and "engb" and "ko " are valid language codes.

The ILocale object provides methods to get and set certain formatting parameters. These are used to get and set certain language-specific patterns or symbols and are described in the ILocale parameter documentation in the http://developer.brewmp.com/reference/api-all. Locale ClassIDs for various languages are defined in AEECLocales.h.

Required Files
AEEILocale.h

AEECLocales.h

Class ID(s)
See AEECLocales.h.
Interface ID
AEEIID_ILocale
Location
platform\system\inc in the Brew MP SDK

The following sample code shows how a DateTime widget can format an AEEDateTime using a pattern that has two characters for month, two characters for day, and "-" as the separator. The resulting formatted date will be "1996-06-03".

int nErr;
ILocale *piLocale = 0;
AEEDateTime testDate = { 1996,  6,  3,  8, 15, 43, 0 };
AECHAR wszDateDelim[] = {'-', 0};
AECHAR wszDatePatt[] = {'Y','/','M','M','/','d','d', 0};

// set date to the test date. piw is datetime widget
nErr = IWIDGET_SetJulianDateTime(piw, (AEEDateTime *)(&testDate));
if (AEE_SUCCESS == nErr) {
   nErr = ISHELL_CreateInstance(piShell, AEECLSID_CLocaleENUS, (void**)&piLocale);
}
if (AEE_SUCCESS == nErr) {
   nErr = ILocale_SetDateSeparator(piLocale, wszDateDelim);
}
if (AEE_SUCCESS == nErr) {
   nErr = ILocale_SetShortDatePattern(piLocale, wszDatePatt);
}
if (AEE_SUCCESS == nErr) {
   nErr = IWidget_SetLocale(piw, piLocale);      
}
RELEASEIF(piLocale);