[Lazarus] Multilang application and syncing .po files

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
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:[hidden email]


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
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


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)


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
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:

> 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


> 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.





--
S pozdravem,
 Tomáš Emresz
 mailto:[hidden email]


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list


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:[hidden email]
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list


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).

--
Best regards,
 Maxim Ganetsky                  mailto:[hidden email]
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
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:



> 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:[hidden email]



--
S pozdravem,
 Tomáš Emresz
 mailto:[hidden email]


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list


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:[hidden email]
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
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
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
Hello Tomáš,
I used this approach several times
and it worked.
For example here:

      Zbyněk

19. 6. 2018 v 14:12, Carlos E. R. via Lazarus <[hidden email]>:

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
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
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:



> 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:[hidden email]



--
S pozdravem,
 Tomáš Emresz
 mailto:[hidden email]


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list


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.

> 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:[hidden email]
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
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)

>> 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..

>> 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:[hidden email]



--
S pozdravem,
 Tomáš Emresz
 mailto:[hidden email]


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
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:[hidden email]
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
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:

> 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:[hidden email]



--
S pozdravem,
 Tomáš Emresz
 mailto:[hidden email]


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list


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:[hidden email]
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Multilang application and syncing .po files

Free Pascal - Lazarus mailing list
Hello,

thanks.

T.E.

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



> 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:[hidden email]



--
S pozdravem,
 Tomáš Emresz
 mailto:[hidden email]


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus