Support forum of the software localization tool Sisulizer


.NET, Delphi, ... - Sisulizer Localization Tool Support Home

Get in contact with the makers of Sisulizer.
Our forum is open for all questions around Sisulizer from customers and prospects.
Don't hesitate to register and ask. The Sisulizer team will answer ASAP.

Search     Help Home Sisulizer Website Download
Search by username
Not logged in - Login | Register 

 Moderated by: Renate.Reinartz, Markus.Kreisel, Jaakko.Salmenius, Ilkka.Salmenius
New Topic Reply Printer Friendly
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
AuthorPost
 Posted: Tue Mar 27th, 2012 02:43 pm
PM Private Upload Quote Reply
jonjon
Member
 

Joined: Tue Mar 6th, 2012
Location:  
Posts: 22
Status: 
Offline
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.

Back To Top PM Private Upload Quote Reply

 Posted: Tue Mar 27th, 2012 02:57 pm
PM Private Upload Quote Reply
Markus.Kreisel
Administrator


Joined: Sat Apr 8th, 2006
Location: Monschau, Germany
Posts: 2207
Status: 
Offline
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
Back To Top PM Private Upload Quote Reply

 Posted: Tue Mar 27th, 2012 03:00 pm
PM Private Upload Quote Reply
Janusz Grzybek
Super Moderator


Joined: Fri Dec 1st, 2006
Location: Zabrze, Poland
Posts: 2988
Status: 
Offline
Markus.Kreisel wrote: 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


 

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
Back To Top PM Private Upload Quote Reply

 Posted: Tue Mar 27th, 2012 03:10 pm
PM Private Upload Quote Reply
jonjon
Member
 

Joined: Tue Mar 6th, 2012
Location:  
Posts: 22
Status: 
Offline
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.

Back To Top PM Private Upload Quote Reply

 Posted: Tue Mar 27th, 2012 03:29 pm
PM Private Upload Quote Reply
Markus.Kreisel
Administrator


Joined: Sat Apr 8th, 2006
Location: Monschau, Germany
Posts: 2207
Status: 
Offline
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
Back To Top PM Private Upload Quote Reply

 Posted: Tue Mar 27th, 2012 04:26 pm
PM Private Upload Quote Reply
Janusz Grzybek
Super Moderator


Joined: Fri Dec 1st, 2006
Location: Zabrze, Poland
Posts: 2988
Status: 
Offline
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.

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.

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
Back To Top PM Private Upload Quote Reply

 Posted: Wed Mar 28th, 2012 12:46 am
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 1316
Status: 
Offline
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
Back To Top PM Private Upload Quote Reply

 Posted: Wed Mar 28th, 2012 09:28 am
PM Private Upload Quote Reply
jonjon
Member
 

Joined: Tue Mar 6th, 2012
Location:  
Posts: 22
Status: 
Offline
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.


Back To Top PM Private Upload Quote Reply

 Posted: Wed Mar 28th, 2012 09:47 am
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 1316
Status: 
Offline
jonjon wrote: 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.



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
Back To Top PM Private Upload Quote Reply

 Posted: Wed Mar 28th, 2012 10:11 am
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 1316
Status: 
Offline
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

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
Back To Top PM Private Upload Quote Reply

 Posted: Wed Mar 28th, 2012 10:21 am
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 1316
Status: 
Offline
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
Back To Top PM Private Upload Quote Reply

 Posted: Wed Mar 28th, 2012 12:19 pm
PM Private Upload Quote Reply
jonjon
Member
 

Joined: Tue Mar 6th, 2012
Location:  
Posts: 22
Status: 
Offline
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.

Back To Top PM Private Upload Quote Reply

 Posted: Thu Mar 29th, 2012 04:58 am
PM Private Upload Quote Reply
Ilkka.Salmenius
Administrator


Joined: Wed Aug 8th, 2007
Location: Tokyo, Japan
Posts: 1316
Status: 
Offline
I fixed this.

Ilkka



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Private Upload Quote Reply

Current time is 08:31 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 ?



WowUltra modified by Sisulizer Copyright © 2007-09 by Jim Hale - Based on WowBB Copyright © 2003-2006 Aycan Gulez

Sisulizer software localization tool - Three simple steps to localize