|
|||
|
.NET, Delphi, ... - Sisulizer Localization Tool Support > Technical Support (You need to be registered at the forum to write) > Bugs and Quirks in Sisulizer > Bug with Delphi resources and default language ?
|
| Moderated by: Renate.Reinartz, Markus.Kreisel, Jaakko.Salmenius, Ilkka.Salmenius |
|
||||||||||||||||
| Bug with Delphi resources and default language ? - Bugs and Quirks in Sisulizer - Technical Support (You need to be registered at the forum to write) - .NET, Delphi, ... - Sisulizer Localization Tool Support | |||||||||||||||||
| Author | Post | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|||||||||||||||||
|
jonjon Member
|
Hi, Here are some computer specs: - French Windows has been installed but English Language has been selected. - Delphi XE - Windows 7 64-bit - Demo application used: Sisulizer 3\Vcl\Delphi\Formats Please explain the following: - Create a new language in slp file for french and generate all languages - Launch Project1 without any language set for that application into registry at HKEY_CURRENT_USER\Software\Embarcadero\Locales - Application is in French... don't know why because Windows language is English ? - Switch application language to English -> application is translated but Registry key for this application is set to empty string - Close and launch application again - Application is still in French as I assume an empty registry key string reverts to default Windows language settings Other test: - Manually set registry key to "EN" - Launch application again -> Application is correctly set in English Thanks. John.
|
||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
|
Markus.Kreisel Administrator
|
Hi John, probably http://www.sisulizer.com/software-localization-tool/vcl.pdf page 32+ gives you the answer when which DLL is loaded. The logic is inside the VCL. If you want more control about this the section "Runtime language switch" might be worth reading as well. Markus
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
|
|||||||||||||||||
|
Janusz Grzybek Super Moderator
|
Markus.Kreisel wrote: Hi John, This document is installed by default with Sisulizer to VCL subdirectory in Sisulizer user directory (Win 7 and Vista) or Sisulizer installation directory (Win XP). Janusz
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
|
jonjon Member
|
I've already read this document and I'm trying to control this by myself, and that's when I run into that issue. I think the biggest problem is in method LaResource.SetInitialResourceLocale (called on initialize) which fails to get default/current language for running application: when requesting for current language afterwards, there is a mismatch between displayed language and language given by LoadedResourceLocale. See previously mentioned steps to reproduce.
|
||||||||||||||||
| |||||||||||||||||
|
|||||||||||||||||
|
Markus.Kreisel Administrator
|
Hi, did you set the system locale like described here: http://www.sisulizer.com/localization/support/codepages-w7.shtml ? Markus
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
|
Janusz Grzybek Super Moderator
|
jonjon wrote: I've already read this document and I'm trying to control this by myself, and that's when I run into that issue. Seem to me that you are right. We currently investigate it (and let you know about results). Janusz
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
|
|||||||||||||||||
|
Ilkka.Salmenius Administrator
|
jonjon wrote: - Application is in French... don't know why because Windows language is English ? It seems that you added LaDefaultLocale.pas into Formats.dpr and your current language settings in Control Panel is French? program Project1; uses LaDefaultLocale, Forms, Unit1 in 'Unit1.pas' {Form1}; {$R *.res} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. Have you? By default VCL application (2010 or later) starts in the language of OS itself. If you add LaDefaultLocale.pas then it looks your country settings of Control Panel and loads a resource DLL matching that. Ilkka
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
|
jonjon Member
|
did you set the system locale like described here: http://www.sisulizer.com/localization/support/codepages-w7.shtml Saw it and changed Windows settings: no changes in behavior. This makes sense as the application is compiled using Delphi XE which is a unicode software. If you add LaDefaultLocale.pas then it looks your country settings of Control Panel and loads a resource DLL matching that. That fixes the problem for default language. But I can't see any reference to this unit in help file, and it looks like it is not part of the provided samples. Also perhaps this should be added to LaResource.pas by default with compiler defines to avoid trouble. Seem to me that you are right. We currently investigate it (and let you know about results). I can still observe this behavior even with the LaDefaultLocale.pas unit included: LoadedResourceLocale is always wrong in that case.
|
||||||||||||||||
| |||||||||||||||||
|
|||||||||||||||||
|
Ilkka.Salmenius Administrator
|
jonjon wrote: If you add LaDefaultLocale.pas then it looks your country settings of Control Panel and loads a resource DLL matching that. This cannot be done because if used LaDefaultLocale.pas must be the first unit to be initialized. The make it so it must be added as first unit into the project file (.dpr). By default VCL\Delphi\Format sample does not contain LaDefaultLocale.pas unit. it is there only if you added the unit into the project. Ilkka
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
|
Ilkka.Salmenius Administrator
|
Please explain the following: I tested this on VCL\Delphi\Formats. Unlike in your case the application appered in English. This is how it should be because my OS is English. If I changed the language to French a fr entry was added into registy and next time when I started in appeared in French. If I changed to English then "" was added to regsitry and it appeared in English on next time. So on my computer (Windows 7, English) it works as it should work. I am sorry but I red your original message incorrectly. You DO have French OS and settings are in Enhlish. I red other way around. Sorry about this. You have French OS so it will appear in French first time you start. If you change language to English then "" will be in registry. This is because there is no Englush resource DLL. The original EXE is English and that why Sisulizer adds empty string. Now here is the problem. When the registry setting is empty VCL will handle it same way as there would be no value in registy and will turn on French. The result is that there is a problem in Sisulizer's way how it marks original language. I need to figure out a solution. Ilkka
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
|
|||||||||||||||||
|
Ilkka.Salmenius Administrator
|
The problem was empty string is registry value. This caused VCL to load the default locale when the intention was not to load any locale. The solution is to write a space instead of an empty string. Here is the fix. Please change your LaResource.pas in the same way procedure SetDefaultLocaleReg(const fileName: String; code: String); var reg: TRegistry; begin reg := TRegistry.Create; try reg.RootKey := HKEY_CURRENT_USER; if reg.OpenKey(LOCALE_OVERRIDE_KEY, True) then begin if code = '' then code := ' '; reg.WriteString(fileName, code); end; finally reg.Free; end; end; This fix will be in the next build (311). Thank you for the bug report. Ilkka
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
|
jonjon Member
|
There is still a problem: I've added laDefaultLocale, and applied the fix and ran the application many times, but when I call LaResource.GetActiveLangId(LANG_ENGLISH) I always get 12 (French) returned, even if registry for that application is set to "EN". When I call LaResource.GetActiveResourceLocale('EN') I always get "FR" too.
|
||||||||||||||||
| |||||||||||||||||
|
|||||||||||||||||
|
Ilkka.Salmenius Administrator
|
I fixed this. Ilkka
____________________ http://www.sisulizer.com - Three simple steps to localize |
||||||||||||||||
| |||||||||||||||||
| Current time is 05:42 pm | |
| .NET, Delphi, ... - Sisulizer Localization Tool Support > Technical Support (You need to be registered at the forum to write) > Bugs and Quirks in Sisulizer > Bug with Delphi resources and default language ? | |
Sisulizer software localization tool - Three simple steps to localize