Sign in Join

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

Mailing lists / lazarus / 2018-06

Multilang application and syncing .po files

16 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Tomáš Emresz

Hello,

i have done generating .po files, could translate it through PoEdit, but - when i add some RS or component, Lazarus update only main .po file, not .cs.po etc. So could Lazarus update these files too, or is there any merge tool for this ? Of course, I understand, that I must translate this string after, but this time, I sync this files manually, which is bad.

Any idea ?

Tomáš Emresz mailto:

Reply by email

Carlos E. R.
to Tomáš Emresz
Tomáš Emresz wrote 10 lines
Hello, i have done generating .po files, could translate it through PoEdit, but - when i add some RS or component, Lazarus update only main .po file, not .cs.po etc. So could Lazarus update these files too, or is there any merge tool for this ? Of course, I understand, that I must translate this string after, but this time, I sync this files manually, which is bad. Any idea ?

I'll answer as translator, I do not yet know how Lazarus handles this.

The programmer should only change the .pot files.

There are other tools that propagate the changes in the .pot to the .po files, which can be used by the programmer (in the Makefile) or the translators, using "msgmerge".

For example, a translator could do:

msgmerge --previous --no-wrap --force-po \
-U $POFILE -C ../memory.es.po $POTFILE
msgfmt --check --stat $POFILE
rm messages.mo

The translator has access to previous translations and memory files to do fuzzy automatic translations which you probably as programmer can't.

The programmer could do:

msgmerge --previous --no-wrap --force-po -U $POFILE $POTFILE msgfmt --check --stat $POFILE
rm messages.mo

Notice the missing memory file

(and repeat for each language)

A sample script as programmer, for all languages:

#!/bin/bash

for FILES in `ls *.po` ;
do
echo
echo $FILES "-------------------------------------------------------------" echo
F=`basename $FILES .po`
FF=`basename $F .es`
POFILE=$FF.es.po
POTFILE=../../00-pot/$FF.pot

    if test -f $POFILE -a -f $POTFILE; then
        echo Applying msgmerge to $POFILE
        msgmerge --previous --no-wrap --force-po -U $POFILE $POTFILE
        msgfmt --check --stat $POFILE
        rm messages.mo
    else
        echo "Not found: " $POFILE or  $POTFILE
    fi || { echo "msgmerge --no-wrap --force-po for \"$POTFILE\" failed" ; }

done

Of course, you'd have to adapt paths to your situation.

Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: OpenPGP digital signature URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180619/df573445/attachment.sig>

Reply by email

Tomáš Emresz
to Carlos E. R.

Hello,

thanks for long answer, but - Lazarus generate only .po file ( and .lrs in output directory). There is no .pot file.

T.E.

úterý 19. června 2018, 13:37:14, napsal jste:

Show quoted text 26 lines
On 2018-06-19 13:09, Tomáš Emresz via Lazarus wrote: > Hello, > > i have done generating .po files, could translate it through PoEdit, > but - when i add some RS or component, Lazarus update only main .po > file, not .cs.po etc. So could Lazarus update these files too, or is > there any merge tool for this ? Of course, I understand, that I must > translate this string after, but this time, I sync this files > manually, which is bad. > > Any idea ? I'll answer as translator, I do not yet know how Lazarus handles this. The programmer should only change the .pot files. There are other tools that propagate the changes in the .pot to the .po files, which can be used by the programmer (in the Makefile) or the translators, using "msgmerge". For example, a translator could do: msgmerge --previous --no-wrap --force-po \ -U $POFILE -C ../memory.es.po $POTFILE msgfmt --check --stat $POFILE rm messages.mo
Show quoted text 10 lines
The translator has access to previous translations and memory files to do fuzzy automatic translations which you probably as programmer can't. The programmer could do: msgmerge --previous --no-wrap --force-po -U $POFILE $POTFILE msgfmt --check --stat $POFILE rm messages.mo Notice the missing memory file
(and repeat for each language)
Show quoted text 25 lines
A sample script as programmer, for all languages: #!/bin/bash for FILES in `ls *.po` ; do echo echo $FILES "-------------------------------------------------------------" echo F=`basename $FILES .po` FF=`basename $F .es` POFILE=$FF.es.po POTFILE=../../00-pot/$FF.pot if test -f $POFILE -a -f $POTFILE; then echo Applying msgmerge to $POFILE msgmerge --previous --no-wrap --force-po -U $POFILE $POTFILE msgfmt --check --stat $POFILE rm messages.mo else echo "Not found: " $POFILE or $POTFILE fi || { echo "msgmerge --no-wrap --force-po for \"$POTFILE\" failed" ; } done
Of course, you'd have to adapt paths to your situation.
S pozdravem, Tomáš Emresz mailto:

Reply by email

Maxim Ganetsky
to Tomáš Emresz: i have done generating .po files, could translate it through PoEdit, but - when i…

19.06.2018 14:09, Tomáš Emresz via Lazarus пишет:

Show quoted text 10 lines
Hello, i have done generating .po files, could translate it through PoEdit, but - when i add some RS or component, Lazarus update only main .po file, not .cs.po etc. So could Lazarus update these files too, or is there any merge tool for this ? Of course, I understand, that I must translate this string after, but this time, I sync this files manually, which is bad. Any idea ?

Which Lazarus version, OS?

Lazarus does update translations together with main .po file. Make sure that your antivirus does not block writing to them (look at dates/times of translation files, if e.g. the half of them have the same date/time after update and the others not, this is antivirus).

Note that you can sync translations with main .po file manually using <lazarusdir>\tools\updatepofiles tool:

updatepofiles mainpofile.po

Best regards, Maxim Ganetsky mailto:

Reply by email

Maxim Ganetsky
to Carlos E. R.: I'll answer as translator, I do not yet know how Lazarus handles this. The programmer…

19.06.2018 14:37, Carlos E. R. via Lazarus пишет:

Show quoted text 15 lines
On 2018-06-19 13:09, Tomáš Emresz via Lazarus wrote: > Hello, > > i have done generating .po files, could translate it through PoEdit, > but - when i add some RS or component, Lazarus update only main .po > file, not .cs.po etc. So could Lazarus update these files too, or is > there any merge tool for this ? Of course, I understand, that I must > translate this string after, but this time, I sync this files > manually, which is bad. > > Any idea ? I'll answer as translator, I do not yet know how Lazarus handles this. The programmer should only change the .pot files.

Lazarus handles all this itself. Main .po file is actually is what you mean by .pot (historically it has .po extension instead of .pot).

Best regards, Maxim Ganetsky mailto:

Reply by email

Tomáš Emresz
to Maxim Ganetsky: 19.06.2018 14:09, Tomáš Emresz via Lazarus пишет: Which Lazarus version, OS?…

Hello,

lazarus 1.8.5 (fixes)
Date : 2018-06-14
FPC: 3.0.5
SVN: 58067
i386-win32-win32/win63

Running on Windows 10 CZ Pro.

In some unit a have added LCLTranslator, setup i18n in project config with right path, so components and resouceestrings showed in po. When I add new, there is in main xxx.po file.

Lang I switching with :

  SetDefaultLang('','langs\');

in lpr on first line after begin.

Should I say Lazarus, that there is also xxx.cs.po (next will be xxx.de.po etc) files or it should detect it in this directory ?

Many thanks

T.E.

úterý 19. června 2018, 13:45:53, napsal jste:

Show quoted text 27 lines
19.06.2018 14:09, Tomáš Emresz via Lazarus пишет: > Hello, > > i have done generating .po files, could translate it through PoEdit, > but - when i add some RS or component, Lazarus update only main .po > file, not .cs.po etc. So could Lazarus update these files too, or is > there any merge tool for this ? Of course, I understand, that I must > translate this string after, but this time, I sync this files > manually, which is bad. > > Any idea ? Which Lazarus version, OS? Lazarus does update translations together with main .po file. Make sure that your antivirus does not block writing to them (look at dates/times of translation files, if e.g. the half of them have the same date/time after update and the others not, this is antivirus). Note that you can sync translations with main .po file manually using <lazarusdir>\tools\updatepofiles tool: updatepofiles mainpofile.po -- Best regards, Maxim Ganetsky mailto:
S pozdravem, Tomáš Emresz mailto:

Reply by email

Maxim Ganetsky
to Tomáš Emresz

19.06.2018 14:55, Tomáš Emresz via Lazarus пишет:

Show quoted text 20 lines
Hello, lazarus 1.8.5 (fixes) Date : 2018-06-14 FPC: 3.0.5 SVN: 58067 i386-win32-win32/win63 Running on Windows 10 CZ Pro. In some unit a have added LCLTranslator, setup i18n in project config with right path, so components and resouceestrings showed in po. When I add new, there is in main xxx.po file. Lang I switching with : SetDefaultLang('','langs\'); in lpr on first line after begin. Should I say Lazarus, that there is also xxx.cs.po (next will be xxx.de.po etc) files or it should detect it in this directory ?

No, Lazarus will find all of them automatically.

Note that Lazarus will update translations only when main .po file is changed (i.e. you made changes to resource strings in code). So in case you place to your directory outdated translation when your main .po file is already up to date, you should use updatepofiles tool, which will update it.

Best regards, Maxim Ganetsky mailto:

Reply by email

Carlos E. R.
to Maxim Ganetsky: 19.06.2018 14:37, Carlos E. R. via Lazarus пишет: Lazarus handles all this itself.…
Maxim Ganetsky wrote 21 lines
19.06.2018 14:37, Carlos E. R. via Lazarus пишет: > On 2018-06-19 13:09, Tomáš Emresz via Lazarus wrote: >> Hello, >> >> i have done generating .po files, could translate it through PoEdit, >> but - when i add some RS or component, Lazarus update only main .po >> file, not .cs.po etc. So could Lazarus update these files too, or is >> there any merge tool for this ? Of course, I understand, that I must >> translate this string after, but this time, I sync this files >> manually, which is bad. >> >> Any idea ? > > I'll answer as translator, I do not yet know how Lazarus handles this. > > The programmer should only change the .pot files. Lazarus handles all this itself. Main .po file is actually is what you mean by .pot (historically it has .po extension instead of .pot).

Well, IMHO that is wrong.

The .pot file should contain all the messages without any translation, it is the master file. And the .po files are the translations, one per language. The .pot file is maintained by the programmers, the .po are maintained by the translators.

Anyway, msgmerge can handle that situation, too.

Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: OpenPGP digital signature URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180619/00aceec8/attachment.sig>

Reply by email

Zbyněk Fiala
to Carlos E. R.

Hello Tomáš,
I used this approach several times
https://github.com/alrieckert/lazarus/tree/master/examples/translation and it worked.
For example here:
https://github.com/zbyna/Media-Stub-Kodi-Creator/blob/2373ec4ff24bf124cb244eab07772e3cc81bee47/unit1.pas#L22 https://github.com/zbyna/Media-Stub-Kodi-Creator/blob/master/unit1.pas#L214

Zbyněk

19. 6. 2018 v 14:12, Carlos E. R. via Lazarus :

Show quoted text 44 lines
> On 2018-06-19 13:51, Maxim Ganetsky via Lazarus wrote: > > > 19.06.2018 14:37, Carlos E. R. via Lazarus пишет: >>> On 2018-06-19 13:09, Tomáš Emresz via Lazarus wrote: >>> Hello, >>> >>> i have done generating .po files, could translate it through PoEdit, >>> but - when i add some RS or component, Lazarus update only main .po >>> file, not .cs.po etc. So could Lazarus update these files too, or is >>> there any merge tool for this ? Of course, I understand, that I must >>> translate this string after, but this time, I sync this files >>> manually, which is bad. >>> >>> Any idea ? >> >> I'll answer as translator, I do not yet know how Lazarus handles this. >> >> The programmer should only change the .pot files. > > Lazarus handles all this itself. Main .po file is actually is what you > mean by .pot (historically it has .po extension instead of .pot). Well, IMHO that is wrong. The .pot file should contain all the messages without any translation, it is the master file. And the .po files are the translations, one per language. The .pot file is maintained by the programmers, the .po are maintained by the translators. Anyway, msgmerge can handle that situation, too. -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar) -- _______________________________________________ Lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180619/21102f79/attachment.html>

Reply by email

Tomáš Emresz
to Maxim Ganetsky: 19.06.2018 14:55, Tomáš Emresz via Lazarus пишет: No, Lazarus will find all of…

Hello,

i was searching for, changing something and I don't understand. When I add force update po on next compile, change showed only in .cs.po (main .po was not changed). When I add some resoucestrings to unit (not form), this RS is not somewhere (I also tried force update .po).

Antivir is disabled.

tool updatepofiles (in other directory for test) did nothing (and needs admin access (drive D, user could write in this directory).

T.E.

úterý 19. června 2018, 14:04:29, napsal jste:

Show quoted text 33 lines
19.06.2018 14:55, Tomáš Emresz via Lazarus пишет: > Hello, > > lazarus 1.8.5 (fixes) > Date : 2018-06-14 > FPC: 3.0.5 > SVN: 58067 > i386-win32-win32/win63 > > Running on Windows 10 CZ Pro. > > In some unit a have added LCLTranslator, setup i18n in project config > with right path, so components and resouceestrings > showed in po. When I add new, there is in main xxx.po file. > > Lang I switching with : > SetDefaultLang('','langs\'); > in lpr on first line after begin. > > Should I say Lazarus, that there is also xxx.cs.po (next will be > xxx.de.po etc) files or it should detect it in this directory ? No, Lazarus will find all of them automatically. Note that Lazarus will update translations only when main .po file is changed (i.e. you made changes to resource strings in code). So in case you place to your directory outdated translation when your main .po file is already up to date, you should use updatepofiles tool, which will update it. -- Best regards, Maxim Ganetsky mailto:
S pozdravem, Tomáš Emresz mailto:

Reply by email

Maxim Ganetsky
to Tomáš Emresz

19.06.2018 16:26, Tomáš Emresz via Lazarus пишет:

Show quoted text 5 lines
Hello, i was searching for, changing something and I don't understand. When I add force update po on next compile, change showed only in .cs.po (main .po was not changed).

Therefore only .cs.po was outdated.

When I add some resoucestrings to unit (not form), this RS is not somewhere (I also tried force update .po).

Is this unit part of project? Please check in Project Inspector.

Antivir is disabled. tool updatepofiles (in other directory for test) did nothing (and needs admin access (drive D, user could write in this directory).
Best regards, Maxim Ganetsky mailto:

Reply by email

Tomáš Emresz
to Maxim Ganetsky

Hello,

úterý 19. června 2018, 16:14:01, napsal jste:

Show quoted text 8 lines
19.06.2018 16:26, Tomáš Emresz via Lazarus пишет: > Hello, > > i was searching for, changing something and I don't understand. When I > add force update po on next compile, change showed only in .cs.po > (main .po was not changed). Therefore only .cs.po was outdated.

Please, what do you exactly mean by this ? (in xxx.po there is no this RS. This new RS was added only to xxx.cs.po but xxx.po was not changed and is missing this RS)

> When I add some resoucestrings to unit > (not form), this RS is not somewhere (I also tried force update .po). Is this unit part of project? Please check in Project Inspector.

Will check this, thanks..

Show quoted text 8 lines
> Antivir is disabled. > > tool updatepofiles (in other directory for test) did nothing (and > needs admin access (drive D, user could write in this directory). -- Best regards, Maxim Ganetsky mailto:
S pozdravem, Tomáš Emresz mailto:

Reply by email

Maxim Ganetsky
to Tomáš Emresz

19.06.2018 21:07, Tomáš Emresz via Lazarus пишет:

Show quoted text 15 lines
Hello, úterý 19. června 2018, 16:14:01, napsal jste: > 19.06.2018 16:26, Tomáš Emresz via Lazarus пишет: >> Hello, >> >> i was searching for, changing something and I don't understand. When I >> add force update po on next compile, change showed only in .cs.po >> (main .po was not changed). > Therefore only .cs.po was outdated. Please, what do you exactly mean by this ? (in xxx.po there is no this RS. This new RS was added only to xxx.cs.po but xxx.po was not changed and is missing this RS)

This is plain impossible.

Best regards, Maxim Ganetsky mailto:

Reply by email

Tomáš Emresz
to Maxim Ganetsky

Hello,

I have checked project inspector, and add some files to it. This time, all is good, both files are updated as needs.

Other question is : is there any possibility to describe RS for PoEdit, like if it is caption on some components ? Something like this :

resourcestring
  //Text when type of addres is Button
  rsButton = 'Button';
  //Text in list of types
  rsListButton = 'Button';

?

Thanks
T.E.

středa 20. června 2018, 0:33:42, napsal jste:

Show quoted text 22 lines
19.06.2018 21:07, Tomáš Emresz via Lazarus пишет: > Hello, > > úterý 19. června 2018, 16:14:01, napsal jste: >> 19.06.2018 16:26, Tomáš Emresz via Lazarus пишет: >>> Hello, >>> >>> i was searching for, changing something and I don't understand. When I >>> add force update po on next compile, change showed only in .cs.po >>> (main .po was not changed). > >> Therefore only .cs.po was outdated. > > Please, what do you exactly mean by this ? (in xxx.po there is no this > RS. This new RS was added only to xxx.cs.po but xxx.po was not changed > and is missing this RS) This is plain impossible. -- Best regards, Maxim Ganetsky mailto:
S pozdravem, Tomáš Emresz mailto:

Reply by email

Maxim Ganetsky
to Tomáš Emresz

20.06.2018 16:30, Tomáš Emresz via Lazarus пишет:

Hello, I have checked project inspector, and add some files to it. This time, all is good, both files are updated as needs.

Good.

Show quoted text 9 lines
Other question is : is there any possibility to describe RS for PoEdit, like if it is caption on some components ? Something like this : resourcestring //Text when type of addres is Button rsButton = 'Button'; //Text in list of types rsListButton = 'Button';

No, but you can use meaningful string identifier names, Poedit shows them.

Best regards, Maxim Ganetsky mailto:

Reply by email

Tomáš Emresz
to Maxim Ganetsky

Hello,

thanks.

T.E.

středa 20. června 2018, 16:24:50, napsal jste:

Show quoted text 23 lines
20.06.2018 16:30, Tomáš Emresz via Lazarus пишет: > Hello, > > I have checked project inspector, and add some files to it. This time, > all is good, both files are updated as needs. Good. > Other question is : is there any possibility to describe RS for > PoEdit, like if it is caption on some components ? Something like this > : > > resourcestring > //Text when type of addres is Button > rsButton = 'Button'; > //Text in list of types > rsListButton = 'Button'; No, but you can use meaningful string identifier names, Poedit shows them. -- Best regards, Maxim Ganetsky mailto:
S pozdravem, Tomáš Emresz mailto:

Reply by email