Language Identifier

You can share your experience with HMG. Share with some screenshots/project details so that others will also be benefited.

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Language Identifier

Post by Pablo César » Tue May 28, 2013 1:26 pm

More one way to find language ID:

Code: Select all

#include "hmg.ch"

Function Main()
Local cLang := Which_Lang( I2Hex( GetUserLangID() ) )

MsgInfo(cLang)
Return Nil

Function Which_Lang(cIdioma)
Local aLangSym:={}, nElement, l, cReturn := ""

/* Language Identifier Constants and Strings - MS Dev Center
   http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).aspx
*/

Aadd(aLangSym,{"0x0C00","NEUTRAL"}) ; Aadd(aLangSym,{"0x1400","NEUTRAL"})
Aadd(aLangSym,{"0x007F","INVARIANT"}) ; Aadd(aLangSym,{"0x0000","NEUTRAL"})
Aadd(aLangSym,{"0x0800","SYSTEM_DEFAULT"}) ; Aadd(aLangSym,{"0x1000","NEUTRAL"})
Aadd(aLangSym,{"0x0400","USER_DEFAULT"}) ; Aadd(aLangSym,{"0x0436","AFRIKAANS"})
Aadd(aLangSym,{"0x041C","ALBANIAN"}) ; Aadd(aLangSym,{"0x0484","ALSATIAN"})
Aadd(aLangSym,{"0x045E","AMHARIC"}) ; Aadd(aLangSym,{"0x1401","ARABIC"})
Aadd(aLangSym,{"0x3C01","ARABIC"}) ; Aadd(aLangSym,{"0x0C01","ARABIC"})
Aadd(aLangSym,{"0x0801","ARABIC"}) ; Aadd(aLangSym,{"0x2C01","ARABIC"})
Aadd(aLangSym,{"0x3401","ARABIC"}) ; Aadd(aLangSym,{"0x3001","ARABIC"})
Aadd(aLangSym,{"0x1001","ARABIC"}) ; Aadd(aLangSym,{"0x1801","ARABIC"})
Aadd(aLangSym,{"0x2001","ARABIC"}) ; Aadd(aLangSym,{"0x4001","ARABIC"})
Aadd(aLangSym,{"0x0401","ARABIC"}) ; Aadd(aLangSym,{"0x2801","ARABIC"})
Aadd(aLangSym,{"0x1C01","ARABIC"}) ; Aadd(aLangSym,{"0x3801","ARABIC"})
Aadd(aLangSym,{"0x2401","ARABIC"}) ; Aadd(aLangSym,{"0x042B","ARMENIAN"})
Aadd(aLangSym,{"0x044D","ASSAMESE"}) ; Aadd(aLangSym,{"0x082C","AZERI"})
Aadd(aLangSym,{"0x042C","AZERI"}) ; Aadd(aLangSym,{"0x0445","BANGLA"})
Aadd(aLangSym,{"0x046D","BASHKIR"}) ; Aadd(aLangSym,{"0x042D","BASQUE"})
Aadd(aLangSym,{"0x0423","BELARUSIAN"}) ; Aadd(aLangSym,{"0x781A","BOSNIAN_NEUTRAL"})
Aadd(aLangSym,{"0x201A","BOSNIAN"}) ; Aadd(aLangSym,{"0x141A","BOSNIAN"})
Aadd(aLangSym,{"0x047E","BRETON"}) ; Aadd(aLangSym,{"0x0402","BULGARIAN"})
Aadd(aLangSym,{"0x0492","CENTRAL_KURDISH"}) ; Aadd(aLangSym,{"0x045C","CHEROKEE"})
Aadd(aLangSym,{"0x0403","CATALAN"}) ; Aadd(aLangSym,{"0x0C04","CHINESE"})
Aadd(aLangSym,{"0x1404","CHINESE"}) ; Aadd(aLangSym,{"0x1004","CHINESE"})
Aadd(aLangSym,{"0x0004","CHINESE_SIMPLIFIED"}) ; Aadd(aLangSym,{"0x7C04","CHINESE_TRADITIONAL"})
Aadd(aLangSym,{"0x0483","CORSICAN"}) ; Aadd(aLangSym,{"0x001A","CROATIAN"})
Aadd(aLangSym,{"0x101A","CROATIAN"}) ; Aadd(aLangSym,{"0x041A","CROATIAN"})
Aadd(aLangSym,{"0x0405","CZECH"}) ; Aadd(aLangSym,{"0x0406","DANISH"})
Aadd(aLangSym,{"0x048C","DARI"}) ; Aadd(aLangSym,{"0x0465","DIVEHI"})
Aadd(aLangSym,{"0x0813","DUTCH"}) ; Aadd(aLangSym,{"0x0413","DUTCH"})
Aadd(aLangSym,{"0x0C09","ENGLISH"}) ; Aadd(aLangSym,{"0x2809","ENGLISH"})
Aadd(aLangSym,{"0x1009","ENGLISH"}) ; Aadd(aLangSym,{"0x2409","ENGLISH"})
Aadd(aLangSym,{"0x4009","ENGLISH"}) ; Aadd(aLangSym,{"0x1809","ENGLISH"})
Aadd(aLangSym,{"0x1809","ENGLISH"}) ; Aadd(aLangSym,{"0x2009","ENGLISH"})
Aadd(aLangSym,{"0x4409","ENGLISH"}) ; Aadd(aLangSym,{"0x1409","ENGLISH"})
Aadd(aLangSym,{"0x3409","ENGLISH"}) ; Aadd(aLangSym,{"0x4809","ENGLISH"})
Aadd(aLangSym,{"0x1c09","ENGLISH"}) ; Aadd(aLangSym,{"0x2C09","ENGLISH"})
Aadd(aLangSym,{"0x0809","ENGLISH"}) ; Aadd(aLangSym,{"0x0409","ENGLISH"})
Aadd(aLangSym,{"0x3009","ENGLISH"}) ; Aadd(aLangSym,{"0x0425","ESTONIAN"})
Aadd(aLangSym,{"0x0438","FAEROESE"}) ; Aadd(aLangSym,{"0x0464","FILIPINO"})
Aadd(aLangSym,{"0x040B","FINNISH"}) ; Aadd(aLangSym,{"0x080c","FRENCH"})
Aadd(aLangSym,{"0x0C0C","FRENCH"}) ; Aadd(aLangSym,{"0x040c","FRENCH"})
Aadd(aLangSym,{"0x140C","FRENCH"}) ; Aadd(aLangSym,{"0x180C","FRENCH"})
Aadd(aLangSym,{"0x100C","FRENCH"}) ; Aadd(aLangSym,{"0x0462","FRISIAN"})
Aadd(aLangSym,{"0x0456","GALICIAN"}) ; Aadd(aLangSym,{"0x0437","GEORGIAN"})
Aadd(aLangSym,{"0x0C07","GERMAN"}) ; Aadd(aLangSym,{"0x0407","GERMAN"})
Aadd(aLangSym,{"0x1407","GERMAN"}) ; Aadd(aLangSym,{"0x1007","GERMAN"})
Aadd(aLangSym,{"0x0807","GERMAN"}) ; Aadd(aLangSym,{"0x0408","GREEK"})
Aadd(aLangSym,{"0x046F","GREENLANDIC"}) ; Aadd(aLangSym,{"0x0447","GUJARATI"})
Aadd(aLangSym,{"0x0468","HAUSA"}) ; Aadd(aLangSym,{"0x0475","HAWAIIAN"})
Aadd(aLangSym,{"0x040D","HEBREW"}) ; Aadd(aLangSym,{"0x0439","HINDI"})
Aadd(aLangSym,{"0x040E","HUNGARIAN"}) ; Aadd(aLangSym,{"0x040F","ICELANDIC"})
Aadd(aLangSym,{"0x0470","IGBO"}) ; Aadd(aLangSym,{"0x0421","INDONESIAN"})
Aadd(aLangSym,{"0x085D","INUKTITUT"}) ; Aadd(aLangSym,{"0x045D","INUKTITUT"})
Aadd(aLangSym,{"0x083C","IRISH"}) ; Aadd(aLangSym,{"0x0434","XHOSA"})
Aadd(aLangSym,{"0x0435","ZULU"}) ; Aadd(aLangSym,{"0x0410","ITALIAN"})
Aadd(aLangSym,{"0x0810","ITALIAN"}) ; Aadd(aLangSym,{"0x0411","JAPANESE"})
Aadd(aLangSym,{"0x044B","KANNADA"}) ; Aadd(aLangSym,{"0x043F","KAZAK"})
Aadd(aLangSym,{"0x0453","KHMER"}) ; Aadd(aLangSym,{"0x0486","KICHE"})
Aadd(aLangSym,{"0x0487","KINYARWANDA"}) ; Aadd(aLangSym,{"0x0457","KONKANI"})
Aadd(aLangSym,{"0x0412","KOREAN"}) ; Aadd(aLangSym,{"0x0440","KYRGYZ"})
Aadd(aLangSym,{"0x0454","LAO"}) ; Aadd(aLangSym,{"0x0426","LATVIAN"})
Aadd(aLangSym,{"0x0427","LITHUANIAN"}) ; Aadd(aLangSym,{"0x082E","LOWER_SORBIAN"})
Aadd(aLangSym,{"0x046E","LUXEMBOURGISH"}) ; Aadd(aLangSym,{"0x042F","MACEDONIAN"})
Aadd(aLangSym,{"0x083E","MALAY"}) ; Aadd(aLangSym,{"0x043e","MALAY"})
Aadd(aLangSym,{"0x044C","MALAYALAM"}) ; Aadd(aLangSym,{"0x043A","MALTESE"})
Aadd(aLangSym,{"0x0481","MAORI"}) ; Aadd(aLangSym,{"0x047A","MAPUDUNGUN"})
Aadd(aLangSym,{"0x044E","MARATHI"}) ; Aadd(aLangSym,{"0x047C","MOHAWK"})
Aadd(aLangSym,{"0x0450","MONGOLIAN"}) ; Aadd(aLangSym,{"0x0850","MONGOLIAN"})
Aadd(aLangSym,{"0x0461","NEPALI"}) ; Aadd(aLangSym,{"0x0414","NORWEGIAN"})
Aadd(aLangSym,{"0x0814","NORWEGIAN"}) ; Aadd(aLangSym,{"0x0482","OCCITAN"})
Aadd(aLangSym,{"0x0448","ORIYA"}) ; Aadd(aLangSym,{"0x0463","PASHTO"})
Aadd(aLangSym,{"0x0429","PERSIAN"}) ; Aadd(aLangSym,{"0x0415","POLISH"})
Aadd(aLangSym,{"0x0416","PORTUGUESE"}) ; Aadd(aLangSym,{"0x0816","PORTUGUESE"})
Aadd(aLangSym,{"0x0867","PULAR"}) ; Aadd(aLangSym,{"0x0446","PUNJABI"})
Aadd(aLangSym,{"0x0846","PUNJABI"}) ; Aadd(aLangSym,{"0x046B","QUECHUA"})
Aadd(aLangSym,{"0x086B","QUECHUA"}) ; Aadd(aLangSym,{"0x0C6B","QUECHUA"})
Aadd(aLangSym,{"0x0418","ROMANIAN"}) ; Aadd(aLangSym,{"0x0417","ROMANSH"})
Aadd(aLangSym,{"0x0419","RUSSIAN"}) ; Aadd(aLangSym,{"0x0485","SAKHA"})
Aadd(aLangSym,{"0x243B","SAMI"}) ; Aadd(aLangSym,{"0x103B","SAMI"})
Aadd(aLangSym,{"0x143B","SAMI"}) ; Aadd(aLangSym,{"0x0C3B","SAMI"})
Aadd(aLangSym,{"0x043B","SAMI"}) ; Aadd(aLangSym,{"0x083B","SAMI"})
Aadd(aLangSym,{"0x203B","SAMI"}) ; Aadd(aLangSym,{"0x183B","SAMI"})
Aadd(aLangSym,{"0x1C3B","SAMI"}) ; Aadd(aLangSym,{"0x044F","SANSKRIT"})
Aadd(aLangSym,{"0x7C1A","SERBIAN_NEUTRAL"}) ; Aadd(aLangSym,{"0x1C1A","SERBIAN"})
Aadd(aLangSym,{"0x181A","SERBIAN"}) ; Aadd(aLangSym,{"0x0C1A","SERBIAN"})
Aadd(aLangSym,{"0x081A","SERBIAN"}) ; Aadd(aLangSym,{"0x046C","SOTHO"})
Aadd(aLangSym,{"0x0832","TSWANA"}) ; Aadd(aLangSym,{"0x0432","TSWANA"})
Aadd(aLangSym,{"0x0459","SINDHI"}) ; Aadd(aLangSym,{"0x0859","SINDHI"})
Aadd(aLangSym,{"0x045B","SINHALESE"}) ; Aadd(aLangSym,{"0x041B","SLOVAK"})
Aadd(aLangSym,{"0x0424","SLOVENIAN"}) ; Aadd(aLangSym,{"0x2C0A","SPANISH"})
Aadd(aLangSym,{"0x400A","SPANISH"}) ; Aadd(aLangSym,{"0x340A","SPANISH"})
Aadd(aLangSym,{"0x240A","SPANISH"}) ; Aadd(aLangSym,{"0x140A","SPANISH"})
Aadd(aLangSym,{"0x1C0A","SPANISH"}) ; Aadd(aLangSym,{"0x300A","SPANISH"})
Aadd(aLangSym,{"0x440A","SPANISH"}) ; Aadd(aLangSym,{"0x100A","SPANISH"})
Aadd(aLangSym,{"0x480A","SPANISH"}) ; Aadd(aLangSym,{"0x080A","SPANISH"})
Aadd(aLangSym,{"0x4C0A","SPANISH"}) ; Aadd(aLangSym,{"0x180A","SPANISH"})
Aadd(aLangSym,{"0x3C0A","SPANISH"}) ; Aadd(aLangSym,{"0x280A","SPANISH"})
Aadd(aLangSym,{"0x500A","SPANISH"}) ; Aadd(aLangSym,{"0x0C0A","SPANISH"})
Aadd(aLangSym,{"0x040A","SPANISH"}) ; Aadd(aLangSym,{"0x540A","SPANISH"})
Aadd(aLangSym,{"0x380A","SPANISH"}) ; Aadd(aLangSym,{"0x200A","SPANISH"})
Aadd(aLangSym,{"0x0441","SWAHILI"}) ; Aadd(aLangSym,{"0x081D","SWEDISH"})
Aadd(aLangSym,{"0x041D","SWEDISH"}) ; Aadd(aLangSym,{"0x041D","SWEDISH"})
Aadd(aLangSym,{"0x045A","SYRIAC"}) ; Aadd(aLangSym,{"0x0428","TAJIK"})
Aadd(aLangSym,{"0x085F","TAMAZIGHT"}) ; Aadd(aLangSym,{"0x0449","TAMIL"})
Aadd(aLangSym,{"0x0849","TAMIL"}) ; Aadd(aLangSym,{"0x0444","TATAR"})
Aadd(aLangSym,{"0x044A","TELUGU"}) ; Aadd(aLangSym,{"0x041E","THAI"})
Aadd(aLangSym,{"0x0451","TIBETAN"}) ; Aadd(aLangSym,{"0x0873","TIGRINYA"})
Aadd(aLangSym,{"0x0473","TIGRINYA"}) ; Aadd(aLangSym,{"0x0873","TIGRIGNA"})
Aadd(aLangSym,{"0x041F","TURKISH"}) ; Aadd(aLangSym,{"0x0442","TURKMEN"})
Aadd(aLangSym,{"0x0422","UKRAINIAN"}) ; Aadd(aLangSym,{"0x042E","UPPER_SORBIAN"})
Aadd(aLangSym,{"0x0820","URDU"}) ; Aadd(aLangSym,{"0x0420","URDU"})
Aadd(aLangSym,{"0x0480","UIGHUR"}) ; Aadd(aLangSym,{"0x0843","UZBEK"})
Aadd(aLangSym,{"0x0443","UZBEK"}) ; Aadd(aLangSym,{"0x0803","VALENCIAN"})
Aadd(aLangSym,{"0x042A","VIETNAMESE"}) ; Aadd(aLangSym,{"0x0452","WELSH"})
Aadd(aLangSym,{"0x0488","WOLOF"}) ; Aadd(aLangSym,{"0x0478","YI"})
Aadd(aLangSym,{"0x046A","YORUBA"})

nElement := aScan( aLangSym, {|l| l[1]="0x"+cIdioma } )
If nElement>0
   cReturn := SubStr(aLangSym[nElement,2],1,1)+Lower(SubStr(aLangSym[nElement,2],2))
Endif
Return cReturn

#pragma BEGINDUMP

#include <windows.h>

HB_FUNC ( GETUSERLANGID )
{
   hb_retni( GetUserDefaultLangID() );
}

static char * u2Hex( WORD wWord )
{
    static far char szHex[ 5 ];
    WORD i= 3;
    do
    {
        szHex[ i ] = 48 + ( wWord & 0x000F );
        if( szHex[ i ] > 57 )
            szHex[ i ] += 7;
            wWord >>= 4;
    }
    while( i-- > 0 );
    szHex[ 4 ] = 0;
    return szHex;
}

HB_FUNC ( I2HEX )
{
   hb_retc( u2Hex( hb_parni( 1 ) ) );
}

#pragma ENDDUMP
I hope to be enjoyed !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Tue May 28, 2013 1:51 pm

I would like to put all this information of aLangSym at any .ch file. But I do not know how I will find hex_string and associate with language....
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
bpd2000
Posts: 1074
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 196 times
Been thanked: 95 times

Post by bpd2000 » Sat Oct 12, 2013 12:31 pm

Any update ?
BPD
Convert Dream into Reality through HMG

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Sat Oct 12, 2013 7:40 pm

Hi Dave, Since is UNICODE in our HMG lives... I have lost interest for this matter. But are you needing any help ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Post Reply