// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** * Copyright (C) 1996-2016, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * Provides functionality for mapping between * LCID and Posix IDs or ICU locale to codepage * * Note: All classes and code in this file are * intended for internal use only. * * Methods of interest: * unsigned long convertToLCID(const char*); * const char* convertToPosix(unsigned long); * * Kathleen Wilson, 4/30/96 * * Date Name Description * 3/11/97 aliu Fixed off-by-one bug in assignment operator. Added * setId() method and safety check against * MAX_ID_LENGTH. * 04/23/99 stephen Added C wrapper for convertToPosix. * 09/18/00 george Removed the memory leaks. * 08/23/01 george Convert to C */ #include "locmap.h" #include "charstr.h" #include "cstring.h" #include "cmemory.h" #include "ulocimp.h" #include "unicode/uloc.h" #if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API #include <windows.h> #include <winnls.h> // LCIDToLocaleName and LocaleNameToLCID #endif /* * Note: * The mapping from Win32 locale ID numbers to POSIX locale strings should * be the faster one. * * Windows LCIDs are defined at https://msdn.microsoft.com/en-us/library/cc233965.aspx * [MS-LCID] Windows Language Code Identifier (LCID) Reference */ namespace … // namespace U_CAPI int32_t uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UErrorCode* status) { … } /* ////////////////////////////////////// // // POSIX --> LCID // This should only be called from uloc_getLCID. // The locale ID must be in canonical form. // ///////////////////////////////////// */ U_CAPI uint32_t uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status) { … } U_CAPI uint32_t uprv_convertToLCID(const char *langID, const char* posixID, UErrorCode* status) { … }