|
|||
| Moderated by: Renate.Reinartz, Markus.Kreisel, Jaakko.Salmenius, Ilkka.Salmenius |
|
|||||||||||||
| Delphi resources loading on Locale - Usage - Three simple steps to localize - Technical Support (You need to be registered at the forum to write) - Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... | ||||||||||||||
| Author | Post | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||
|
bikemike Member
|
Hi For my Delphi application i am just looking at the automatic resource loading behaviour and looking to filter that against licensed languages.... I can't set a locale so that my CHT resource gets loaded (I can do a run time switch ok) I can set Localse to PRC and get my CH resources loaded automatically. I can understand this. Portuguese works as expected - if I set Windows to locale Brazil VCL uses my PTB pack, setting locale to Portugal does not, it remains in default language - English. Spanish Spain seems right, but when I set the windows locale to Spanish Spain, the ESP resources do NOT get auto loaded via VCL at start up. Why not? All my other packs work as expected : RU, FR, SV, (SW), TR, CS, DE, FI, HU, IT, KO, NL, PO
|
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
bikemike Member
|
Furthermore... How can I get a description such as Spanish (Spain) from _es_ES ? In this context I can't know that I'm trying to use my ESP resources, I can advise the user to switch to Spanish at run time (And then the registry will get ESP and next time I start I get the 1034 language and all goes well) Locale Registry Spanish Spanish Spain Spain GetActiveLangId 0 1034 GetActiveResourceLocale "" ESP LocaleToIso639(GetActiveLangId) es es_ES GetLocaleExtension _es_ES _es_ES IsResourceFileLoaded FALSE TRUE GetCurrentDefaultLocaleReg "" ESP GetActiveCodePage 0 1252 Available Ext ESP ESP
|
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Jaakko.Salmenius Administrator
|
VCL loads the resource DLL according the following rules 1) It looks from registry under following key if the application's locale has been set. - HKEY_CURRENT_USER\Software\CodeGear\Locales - HKEY_LOCAL_MACHINE\Software\CodeGear\Locales - HKEY_CURRENT_USER\Software\Borland\Locales - HKEY_CURRENT_USER\Software\Borland\Delphi\Locales The above order is for Delphi 2009. Older Delphi may not load from CodeGear key. If the registry key contains locale for current application VCL will use it. For example HKEY_CURRENT_USER\Software\CodeGear\Locales key might contains the following value: D:\Features\Runtime\Delphi2009\Project1.exe DE It instructs VCL to load Project1.DE 2) If there is not value in the registry or the resource DLL that was give there does not exist the VCL tries to load DLL matching to the system locale. This means if you have system locale German (Germany) = de_DE, VCL will seach for .DEU. 3) If the exact match does not exists then VCL tries to load country neutral resource DLL (e.g. DE instead of DEU). 4) Otherwise VCL does not load DLL but uses the resources of EXE In your case .CHT is only loaded if you set your system locale to Chinese (Taiwan). If you system locale is some other Chinese VCL does not load it automatically. However you can override it by setting the locale value (CHT) in the HKEY_CURRENT_USER\Software\CodeGear\Locales registry. Your .PTB is only loaded if system locale is Portuguese (Brazil). it does not get loaded if localize is Portuguese (Portugal). In order to use Portuguese in both locales the DLL extension must be .PT. Either rename the DLL from .PTB to .PT or change the column in the SL project to contains country neutral Portuguese instead of Brazilian Portuguese. You can find the above logic from VCL source code. Look for <delphi>\Source\Win32\rtl\sys\System.pas and look for LoadResourceModule functions. It performs the loading. Jaakko
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
bikemike Member
|
Yes, I follow this, and I read the help and all works well and as expected, as I said. But my post description is Problem with Spanish. Spanish does not. I have tried all these languages and VCL loads in the language selected. (Excepting that CH is Chinese Simplified in Sisulizer, not PRC, and CHT is Chinese Traditional, not Taiwan which is confusing...) With Spanish you can see from my second post that the locale has been detected, _es_ES, but no localised resources have been loaded. Those resources do exist and they do load if I set the registry key to ESP (the extension of the resource file created by Sisulizer). Would you expect spanish resources to load with the locale set to Spanish (Spain) when the resource was generated in Sisulizer from the Spanish (Spain) language? I am expecting that to work.
|
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
Jaakko.Salmenius Administrator
|
There are two Spanish (Spain) variants: traditional and international (modern) sorts. ESP is for traditional sort. ESN is for international. The computer that is trying to run .ESP might have international sort turned on so it tries to load .ESN instead. You can change the sorting order from control panel's international settings. See screen shot. It is for Vista. In XP it is little bit different. I recommend using country neutral Spanish so SL will create .ES that will load not matter what Spanish locale the computer has. Jaakko Attachment: Untitled.png (Downloaded 20 times)
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Jaakko.Salmenius Administrator
|
Starting from build 273 the language language contains two Spanish (Spain) values: 1) Spanish (Spain, Traditional Sort) code: es-ES ext: ESP 2) Spanish (Spain, International Sort) code: es-ES-MOD ext: ESN Jaakko Attachment: Untitled.png (Downloaded 18 times)
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
|
||||||||||||||
|
bikemike Member
|
Yes, this works now. My existing project spits out ESN rather than ESP now, and when the PC is set to Spanish Spain, these resources are loaded. Thanks. One thing, I won't have both, but when I do have both ESP and ESN on my machine, the list of available languages, shown by the LaDialog for example, shows both as Spanish Spain.
|
|||||||||||||
| ||||||||||||||
| ||||||||||||||
|
Jaakko.Salmenius Administrator
|
bikemike wrote: One thing, I won't have both, but when I do have both ESP and ESN on my machine, the list of available languages, shown by the LaDialog for example, shows both as Spanish Spain. I fixed this in 274. Jaakko
____________________ http://www.sisulizer.com - Three simple steps to localize |
|||||||||||||
| ||||||||||||||
| Current time is 11:59 pm | |
| Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... > Technical Support (You need to be registered at the forum to write) > Usage - Three simple steps to localize > Delphi resources loading on Locale | |
Sisulizer software localization tool - Three simple steps to localize