UniCompleteUserLocale
UniCompleteUserLocale is used to finish a locale modification. This API is called after one or more UniSetUserLocaleItem calls to cause the new user defined locale file to be saved.
Syntax
int UniCompleteUserLocale( void )
Parameters
None required.
Returns
Return value (int) - returns
- ULS_SUCCESS
- Successful completion; overridden items have been written to a file.
- ERROR_OPEN_FAILED
- DosOpen failed to open the locale file.
- ERROR_ACCESS_DENIED
- DosWrite failed due to denied access.
- ULS_NOMEMORY
- Insufficient memory to create a buffer for writing the new locale.
Remarks
UniCompleteUserLocale is used to complete the process of defining a new locale or modifying an existing locale. An application will use the UniQueryLocale* APIs and UniSetUserLocaleItem to take an existing locale definition and customize that definition to form a new locale. When the customization process is complete, UniCompleteUserLocale is invoked to save the results as a new locale.
The result of calling this API is that the locale is saved to disk as a new user locale or changes to an existing locale are saved to disk to represent the newly created locale.
Example
This example shows how to complete a user locale after modifying one or more locale items.
#include <stdio.h> #include <unidef.h> int main(void) { LocaleObject locale_object = NULL; UniChar *uniUsrLocales; /* Array containing user locales */ int rc = ULS_SUCCESS; /*****************************************************************/ /* Assumes LANG environment variable set to a valid locale name, */ /* such as fr_FR */ /*****************************************************************/ rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locale_object); if (rc != ULS_SUCCESS) { printf("UniCreateLocaleObject error: return code = %u\n", rc); return 1; } /* allocate space for the user defined locales */ uniUsrLocales = (UniChar *) malloc(4096); /* Query the list of user defined locales available to modify */ rc = UniQueryLocaleList(UNI_USER_LOCALES, uniUsrLocales, 2048); if (rc != ULS_SUCCESS) { printf("UniQueryLocaleList error: return code = %u\n", rc); return 1; } . . . /* Change locale definition by calling UniSetUserLocaleItem to make * locale item changes. */ . . . /* Write the current set of user locales to disk */ rc = UniCompleteUserLocale(); if (rc != ULS_SUCCESS) { printf("UniCompleteUserLocale error: return code = %u\n", rc); return 1; } return ULS_SUCCESS; }
Format
#include <unidef.h> int UniCompleteUserLocale( void )