Recent

Author Topic: Internationalizationg a program  (Read 10481 times)

dcelso

  • Full Member
  • ***
  • Posts: 158
Re: Internationalizationg a program
« Reply #15 on: March 06, 2013, 06:57:16 pm »
Yes,you are right.
System is for using the language defined in the system.
And default is for using the strings values put in the lazarus IDE in developed time.
In this case, I developed it in english. But when I select it in my demo. It does not do anything.  It leaves the language of before.
I'm searching a method to use the written strings in the lazarus IDE instead of use .po file, when you select the defaul language.

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Internationalizationg a program
« Reply #16 on: March 06, 2013, 08:12:03 pm »
Well, you develop your app. in english, i.e. all button.captions labels, etc. are in english and in your source you have your own strings defined in section "resourcestrings".
And you have several *.po files with translations.

If you want to keep it in english, then simply do not do any translation.

I don't know what translator you use but maybe that the translation is done in "initialization" section of that unit therefore you cannot keep it in english.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

dcelso

  • Full Member
  • ***
  • Posts: 158
Re: Internationalizationg a program
« Reply #17 on: March 06, 2013, 09:58:24 pm »
Exactly. That you sais work well. But i need do it in run time,ie, while the app is runnig. If you see the example application i'm using defaulttranslator unit given by lazarus. And when i change the language with the combobox it automatically changes the language. But i dont know how dissable translation in run time. I thought that using setdefaultlan('') i get it.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Internationalizationg a program
« Reply #18 on: March 06, 2013, 10:13:12 pm »
warning I haven't used the build in translation support so I can only guess and only if I understand the problem correctly.

Your problem is that when you select the default translation at run time the forms already open do not translate to the default language.
The problem as far as I understand is that the translation process does not know or cares what is the default language it does not exists on any outside file so it can not load them and set them.
Those strings are part of the applications resource table and are in a form that only the internal streaming functionality can access them correctly while the current translation environment uses property names and values to set them it does not know and can not load the data from resources.

This is to be expected and until a different translation environment is used there is no way of doing that. The main problem is that a resource based translation creates owned objects as it reads them from the resource and does not try to find them in memory, this creates a lot of problems and conflicts with existing data.
So for now I suggest to either
1) request a restart when the default language is chosen
2) create a default language external file and use that to translate the application when the default is chosen only and do not translate when the application starts.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

dcelso

  • Full Member
  • ***
  • Posts: 158
Re: Internationalizationg a program
« Reply #19 on: March 06, 2013, 10:27:25 pm »
  :o, yeah. I understand. I didn't thougth it. Then I will use your second solution. Thanks.

 

TinyPortal © 2005-2018