Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-08

DefaultTranslator

14 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

patspiper

I added DefaultTranslator to the uses clause of a unit, changed the env variable LANG to es_ES.utf8, and the controls caption were changed as expected. However, resource strings were not. Are they supposed to be changed in this case?

Furthermore, --lang does not set the language if the LANG environment variable is defined. Shouldn't --lang override the environment variable?

--Using Ubuntu 10.04--

Reply by email

Maxim Ganetsky
to patspiper

19.08.2010 0:26, patspiper ?????:

I added DefaultTranslator to the uses clause of a unit, changed the env variable LANG to es_ES.utf8, and the controls caption were changed as expected. However, resource strings were not. Are they supposed to be changed in this case?

No.

Best regards, Maxim Ganetsky mailto:

Reply by email

patspiper
to Maxim Ganetsky
Maxim Ganetsky wrote 8 lines
19.08.2010 0:26, patspiper ?????: > I added DefaultTranslator to the uses clause of a unit, changed the env > variable LANG to es_ES.utf8, and the controls caption were changed as > expected. However, resource strings were not. Are they supposed to be > changed in this case? No.

What's the logic behind this behavior? Shouldn't the translator translate the whole form/application?

Reply by email

Maxim Ganetsky
to patspiper

19.08.2010 1:46, patspiper ?????:

Show quoted text 11 lines
On 08/19/2010 12:37 AM, Maxim Ganetsky wrote: > 19.08.2010 0:26, patspiper ?????: >> I added DefaultTranslator to the uses clause of a unit, changed the env >> variable LANG to es_ES.utf8, and the controls caption were changed as >> expected. However, resource strings were not. Are they supposed to be >> changed in this case? > > No. > What's the logic behind this behavior? Shouldn't the translator translate the whole form/application?

It translates the whole form, but resourcestrings you should translate manually.

Best regards, Maxim Ganetsky mailto:

Reply by email

waldo kitty
to Maxim Ganetsky
Maxim Ganetsky wrote 6 lines
19.08.2010 1:46, patspiper ?????: > What's the logic behind this behavior? Shouldn't the translator > translate the whole form/application? It translates the whole form, but resourcestrings you should translate manually.

i assume that this means that you have to have resourcestrings for each language the app supports and that it must choose which resourcestrings to use via code based on the selected language??

Reply by email

Maxim Ganetsky
to waldo kitty

19.08.2010 20:14, waldo kitty ?????:

Show quoted text 12 lines
On 8/18/2010 17:53, Maxim Ganetsky wrote: > 19.08.2010 1:46, patspiper ?????: >> What's the logic behind this behavior? Shouldn't the translator >> translate the whole form/application? > > It translates the whole form, but resourcestrings you should translate > manually. > i assume that this means that you have to have resourcestrings for each language the app supports and that it must choose which resourcestrings to use via code based on the selected language??

No, you don't need to "have resourcestrings for each language the app supports". See
http://wiki.lazarus.freepascal.org/Translations_/_i18n_/_localizations_for_programs for details.

Best regards, Maxim Ganetsky mailto:

Reply by email

patspiper
to Maxim Ganetsky: 19.08.2010 1:46, patspiper ?????: It translates the whole form, but resourcestrings you…
Maxim Ganetsky wrote 17 lines
19.08.2010 1:46, patspiper ?????: > On 08/19/2010 12:37 AM, Maxim Ganetsky wrote: >> 19.08.2010 0:26, patspiper ?????: >>> I added DefaultTranslator to the uses clause of a unit, changed the >>> env >>> variable LANG to es_ES.utf8, and the controls caption were changed as >>> expected. However, resource strings were not. Are they supposed to be >>> changed in this case? >> >> No. >> > What's the logic behind this behavior? Shouldn't the translator > translate the whole form/application? It translates the whole form, but resourcestrings you should translate manually.

Should this be considered a shortcoming of the default translator that will eventually be fixed?

The default translator checks the environment variable LANG and even allows you to override the system language using the --lang parameter. I vote for having the default translator handle resource strings the same way.

Reply by email

Maxim Ganetsky
to patspiper

20.08.2010 2:46, patspiper ?????:

Show quoted text 6 lines
On 08/19/2010 12:53 AM, Maxim Ganetsky wrote: > It translates the whole form, but resourcestrings you should translate > manually. > Should this be considered a shortcoming of the default translator that will eventually be fixed?

No. Resourcestrings are initialized per unit (unit name is required for this process), and DefaultTranslator knows nothing about your unit names.

Initializing resourcestrings is simple. See translations.pas header or http://wiki.lazarus.freepascal.org/Translations_/_i18n_/_localizations_for_programs .

The default translator checks the environment variable LANG and even allows you to override the system language using the --lang parameter. I vote for having the default translator handle resource strings the same way.

See above.

Best regards, Maxim Ganetsky mailto:

Reply by email

Bogusław Brandys
to Maxim Ganetsky

Maxim Ganetsky pisze:

Show quoted text 7 lines
20.08.2010 2:46, patspiper ?????: > I vote for having the default translator handle resource strings the > same way. Added in r27154. Please test.

Btw. does it still use .po files or I can now use .mo files also ?

Boguslaw

Reply by email

patspiper
to Maxim Ganetsky: 20.08.2010 2:46, patspiper ?????: Added in r27154. Please test. Maxim Ganetsky …
Maxim Ganetsky wrote 7 lines
20.08.2010 2:46, patspiper ?????: > I vote for having the default translator handle resource strings the > same way. Added in r27154. Please test.

That is great news! I tested and it works fine. It is enough to add unit DefaultTranslator to one of the project's units to get the whole project translated.

IMHO, it was a logical step as one would want either to automatically translate all or none. If one needs to translate specific parts, then it can still be done manually.

Finally, the LANG environment variable overrides the --lang command line parameter. I have created a patch (attached) that rectifies this. I will create a bug report too.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: DefaultTranslator.diff
Type: text/x-patch
Size: 869 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100820/e23e35c9/attachment.bin>

Reply by email

Maxim Ganetsky
to Bogusław Brandys: Maxim Ganetsky pisze: Btw. does it still use .po files or I can now use .mo files also ?…

20.08.2010 12:34, Bogus?aw Brandys ?????:

Show quoted text 10 lines
Maxim Ganetsky pisze: > 20.08.2010 2:46, patspiper ?????: > >> I vote for having the default translator handle resource strings the >> same way. > > Added in r27154. Please test. > Btw. does it still use .po files or I can now use .mo files also ?

Previously it used only .mo files. Now it first searches for .po file and if .po is not found it searches for .mo file.

Best regards, Maxim Ganetsky mailto:

Reply by email

waldo kitty
to Maxim Ganetsky
Maxim Ganetsky wrote 15 lines
20.08.2010 12:34, Bogus?aw Brandys ?????: > Maxim Ganetsky pisze: >> 20.08.2010 2:46, patspiper ?????: >> >>> I vote for having the default translator handle resource strings the >>> same way. >> >> Added in r27154. Please test. >> > > Btw. does it still use .po files or I can now use .mo files also ? Previously it used only .mo files. Now it first searches for .po file and if .po is not found it searches for .mo file.

please forgive me... i've not yet used any translation stuffings... may i ask what are "mo files" and "po files" ??

or rather, instead of asking "may i", perhaps i should just ask straight out, what are those files?

Reply by email

Vincent Snijders
to waldo kitty

2010/8/21 waldo kitty :

Show quoted text 6 lines
please forgive me... i've not yet used any translation stuffings... may i ask what are "mo files" and "po files" ?? or rather, instead of asking "may i", perhaps i should just ask straight out, what are those files?

I guess it is best if you read the link posted earlier in this thread: http://wiki.lazarus.freepascal.org/Translations_/_i18n_/_localizations_for_programs

Of course you may ask, but those link were posted to inform you...

Vincent

Reply by email