benners Posted February 26, 2017 Share Posted February 26, 2017 I am trying to get specific geographical info by using a LCID hex string (such as 0409, 0809, 0401 etc) I am mainly interested in the culture name . I could get the info I require a few ways by creating functions based on info Here or Here but by supplying the correct info to _WinAPI_GetGeoInfo() I can easily get what I need and the info should always be up to date. I have the other language info I need by using _WinAPI_GetLocaleInfo() but I need the culture name, i.e, en-us or uz-latn-uz on so on. This is obtained by using _WinAPI_GetGeoInfo and passing the identifier for the geographical location like below #include <WinAPILocale.au3> #include <APILocaleConstants.au3> Local $iID = _WinAPI_GetUserGeoID() ; need to convert LCID to geographical location identifier ConsoleWrite('ID: 0x' & Hex($iID) & @CRLF) ConsoleWrite('Nation: ' & _WinAPI_GetGeoInfo($iID, $GEO_NATION) & @CRLF) ConsoleWrite('GEO_ISO2: ' & _WinAPI_GetGeoInfo($iID, $GEO_ISO2) & @CRLF) ConsoleWrite('GEO_ISO3: ' & _WinAPI_GetGeoInfo($iID, $GEO_ISO3) & @CRLF) ConsoleWrite('GEO_RFC1766: ' & _WinAPI_GetGeoInfo($iID, $GEO_RFC1766) & @CRLF) ; this is the main info I need ConsoleWrite('GEO_LCID: ' & _WinAPI_GetGeoInfo($iID, $GEO_LCID) & @CRLF) ConsoleWrite('GEO_FRIENDLYNAME: ' & _WinAPI_GetGeoInfo($iID, $GEO_FRIENDLYNAME) & @CRLF) ConsoleWrite('GEO_OFFICIALNAME: ' & _WinAPI_GetGeoInfo($iID, $GEO_OFFICIALNAME) & @CRLF) ConsoleWrite('GEO_OFFICIALLANGUAGES: ' & _WinAPI_GetGeoInfo($iID, $GEO_OFFICIALLANGUAGES) & @CRLF) ConsoleWrite('GEO_ISO_UN_NUMBER: ' & _WinAPI_GetGeoInfo($iID, $GEO_ISO_UN_NUMBER) & @CRLF) ConsoleWrite('GEO_PARENT: ' & _WinAPI_GetGeoInfo($iID, $GEO_PARENT) & @CRLF & @CRLF) $iID = Dec('0809');_WinAPI_GetUserDefaultLCID() ConsoleWrite('Language => ' & _WinAPI_GetLocaleInfo($iID, $LOCALE_SLANGUAGE) & @CRLF) ; English (United Kingdom) ConsoleWrite('ShortName => ' & _WinAPI_GetLocaleInfo($iID, $LOCALE_SABBREVCTRYNAME) & @CRLF) ; GBR ConsoleWrite('Country Name => ' & _WinAPI_GetLocaleInfo($iID, $LOCALE_SNATIVECTRYNAME) & @CRLF) ; United Kingdom ConsoleWrite('DefaultLang => ' & _WinAPI_GetLocaleInfo($iID, $LOCALE_IDEFAULTLANGUAGE) & @CRLF) ; 0809 So what I need to do is somehow change the LCID to a GeoID then run the function or create a wrapper to convert the LCID. There maybe another _WinAPI function that could get me the info but I haven't had any luck playing around with the ones under the Internationalization Management part of the help file. Any suggestions? Link to comment Share on other sites More sharing options...
UEZ Posted February 26, 2017 Share Posted February 26, 2017 As far as I see you have two tables - one with LCID and another one with GeoID. You should be able to search between both tables easily. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
benners Posted February 26, 2017 Author Share Posted February 26, 2017 If you mean the web pages, not all the locations in one page are in the other. The NLS page has the info I can query but the function will have 350+ case statements based on different LCID values. I thought i could use _WinAPI_GetGeoInfo() and save some time. Link to comment Share on other sites More sharing options...
UEZ Posted February 26, 2017 Share Posted February 26, 2017 Something like this here? -> http://vbnet.mvps.org/index.html?code/locale/getgeoinfo.htm Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
benners Posted February 26, 2017 Author Share Posted February 26, 2017 (edited) That was one of the many links I landed on as well. Looking at the Private CONST list in the code, it returns the same info as _WinAPI_GetGeoInfo() would. I decided to bite the bullet and create a function using the info from the NLS web page. First Draft, needs error checks adding and what not. nls.au3 Edited February 26, 2017 by benners Added download Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now