zoukankan      html  css  js  c++  java
  • NLS编程

    NLS(National Language Support)

    Background(背景)

    Each language has a language name and a language identifierthat indicate the particular code page (ANSI, DOS, Macintosh) used to represent the geographical location for the language on the operating system. 

    Data Type(数据类型)

    typedef WORD LANGID;
    typedef DWORD LCID;
    typedef DWORD LCTYPE;


    Usage(使用)

    Each locale has a unique identifier, a 32-bit value that consists of a language identifier and a sort order identifier. The locale identifier is a standard international numeric abbreviation and has the components necessary to uniquely identify one of the installed operating system-defined locales. 

    The following illustration shows the format of the bits in a locale identifier.
    +-------------+---------+-------------------------+
    |   Reserved  | Sort ID |      Language ID        |
    +-------------+---------+-------------------------+
    31         20 19     16 15                      0   bit

    The following illustration shows the format of the bits in a language identifier. 
    +-------------------------+-------------------------+
    |     SubLanguage ID      |   Primary Language ID   |
    +-------------------------+-------------------------+
    15                    10  9                         0   bit

    Get LCID(locale indentifier)

    LCID GetThreadLocale(void);


    Modify customed LCID for thread
    BOOL SetThreadLocale ( LCID Locale );

    Compose LCID
    DWORD MAKELCID(
    	  WORD wLanguageID,  
    	  WORD wSortID
    	);
    for sort order identifier, please refer to link.

    Compose LANGID
    WORD MAKELANGID(
    	  USHORT usPrimaryLanguage,  
    	  USHORT usSubLanguage       
    	);

    for languange identifier constants and strings, please refer to  link


    Example:
    SetThreadLocale(MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_GERMAN_PHONE_BOOK));

    Extract Sort Identifier
    WORD SORTIDFROMLCID(
    	  LCID lcid  
    	);

    Extract Language Identifer
    	WORD LANGIDFROMLCID(
    	  LCID lcid  
    	);

    Extract Primary language identfier
    	WORD PRIMARYLANGID(
    	  WORD lgid  
    	);
    

    Extract a sublanguage identifier
    	WORD SUBLANGID(
    	  WORD lgid  
    	);







     
  • 相关阅读:
    20个命令行工具监控 Linux 系统性能【转载】
    机器学习及部分NLP相关网上的代码资源整理
    职场中脱颖而出的成长秘诀【转载】
    美好的诗词
    其实这是一种生活方式【转载】
    10个非常有趣的Linux命令【转载】
    如何摆脱工具类【转载】
    在线公开课 | 如何基于模型训练平台快速打造AI能力?
    企业应用架构演化探讨:从微服务到Service Mesh
    生命的价值——大型科技公司的时间“减”史
  • 原文地址:https://www.cnblogs.com/rogerroddick/p/2846691.html
Copyright © 2011-2022 走看看