Sign in Join

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

Mailing lists / lazarus / 2016-02

Replacing LRT format with RSJ

13 messages · 9 people · –

Reply by email Subscribe to this list Your subscription

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

Maxim Ganetsky

Hello.

Currently we use .lrt file to store translatable strings extracted from forms.

This format is broken, because it cannot handle multiline resource strings (e.g. multiline hints).

See the following bug report for details:

http://bugs.freepascal.org/view.php?id=26553

I propose to generate this file in RSJ format (also used by FPC 3.0.0 and up).

Therefore the plan is:

1) Remove LRT support completely, replacing it with RSJ.

2) Although generated file would be in RSJ format its extension will be .lrj in order to avoid possible filename clashes, e.g. when output directory is the same as project directory.

As a result people using this feature will need to remove their .lrt files and save all affected forms again in order to generate .lrj files. No other changes should be needed.

Any comments?

Best regards, Maxim Ganetsky mailto:

Reply by email

Giuliano Colla
to Maxim Ganetsky

Il 16/02/2016 17:29, Maxim Ganetsky ha scritto:

Show quoted text 5 lines
As a result people using this feature will need to remove their .lrt files and save all affected forms again in order to generate .lrj files. No other changes should be needed. Any comments?

To actually provide the benefit to users, it would be nice if the transition process would be made automatic in Lazarus IDE. I.e.: If in Project Options "Enable i18n" and "Create/update .po file when saving" are both ticked, a "Compile" should check for the presence of .lrt files and behave accordingly, i.e. remove .lrt files and generate again what required.

Is that possible?

Giuliano

Reply by email

Maxim Ganetsky
to Giuliano Colla

16.02.2016 20:31, Giuliano Colla ?????:

Show quoted text 15 lines
Il 16/02/2016 17:29, Maxim Ganetsky ha scritto: > As a result people using this feature will need to remove their .lrt > files and save all affected forms again in order to generate .lrj files. > No other changes should be needed. > > Any comments? To actually provide the benefit to users, it would be nice if the transition process would be made automatic in Lazarus IDE. I.e.: If in Project Options "Enable i18n" and "Create/update .po file when saving" are both ticked, a "Compile" should check for the presence of .lrt files and behave accordingly, i.e. remove .lrt files and generate again what required. Is that possible?

Not without forcibly saving all affected forms. I don't think it is good, because LFMs can change (e.g. when form created in Linux and saved in Windows).

Best regards, Maxim Ganetsky mailto:

Reply by email

JuuS
to Maxim Ganetsky: Hello. Currently we use .lrt file to store translatable strings extracted from forms.…
Maxim Ganetsky wrote 7 lines
Hello. Currently we use .lrt file to store translatable strings extracted from forms. This format is broken, because it cannot handle multiline resource strings (e.g. multiline hints).

Hi,

I've already submitted a patch, in October, at

http://bugs.freepascal.org/view.php?id=28740

Note that there will be issues from older versions to newer versions. Read the notes there at the page.

Currently I simply update the laz files after I upgrade because I too use multiLine hints. This fix will also fix multi-line edits, etc.

Julius

Reply by email

Denis Kozlov

It should be possible to code up an automatic conversion of LRT files directly to RSJ/LSJ, without a need to resave all forms. They both store the same data, but use a different format.

Of course, LRT files with already broken strings (as a result of new lines) would be initially mapped 1-to-1 to broken strings in RSJ file, but they will get fixed the next time the form is re-saved.

Denis

Maxim Ganetsky wrote 15 lines
16.02.2016 20:31, Giuliano Colla ?????: > To actually provide the benefit to users, it would be nice if the > transition process would be made automatic in Lazarus IDE. > I.e.: If in Project Options "Enable i18n" and "Create/update .po file > when saving" are both ticked, a "Compile" should check for the presence > of .lrt files and behave accordingly, i.e. remove .lrt files and > generate again what required. > > Is that possible? Not without forcibly saving all affected forms. I don't think it is good, because LFMs can change (e.g. when form created in Linux and saved in Windows).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160217/55a577d6/attachment.html>

Reply by email

Maxim Ganetsky
to Denis Kozlov

17.02.2016 18:24, Denis Kozlov ?????:

Show quoted text 7 lines
It should be possible to code up an automatic conversion of LRT files directly to RSJ/LSJ, without a need to resave all forms. They both store the same data, but use a different format. Of course, LRT files with already broken strings (as a result of new lines) would be initially mapped 1-to-1 to broken strings in RSJ file, but they will get fixed the next time the form is re-saved.

So users will need to save forms anyway in order to ensure strings correctness and to get correct .po files.

Maybe some helper tool that resaves all affected forms in one go can be created, though. Don't know how big is demand for it.

Best regards, Maxim Ganetsky mailto:

Reply by email

Bart
to Maxim Ganetsky
Maxim Ganetsky wrote 5 lines
So users will need to save forms anyway in order to ensure strings correctness and to get correct .po files. Maybe some helper tool that resaves all affected forms in one go can be created, though. Don't know how big is demand for it.

Just announce it on the ML and forum, maybe somewhere on the wiki and just implement.

Bart

Reply by email

Denis Kozlov
to Maxim Ganetsky: 17.02.2016 18:24, Denis Kozlov ?????: So users will need to save forms anyway in order to…

It would be useful to have a built-in option to regenerate base PO file (and update translated PO files) for a project.

This could involve:
1) Removing all existing LRT, LRJ, RST, RSJ.
2) Forcing project to be recompiled to reprocess resourcestrings and produce RSJ
3) Forcing forms to be resaved to reprocess LFM and produce LRJ

I have performed these steps manually on several occasions to ensure a clean regenerated PO file.

Maxim Ganetsky wrote 16 lines
17.02.2016 18:24, Denis Kozlov ?????: > It should be possible to code up an automatic conversion of LRT files > directly to RSJ/LSJ, without a need to resave all forms. They both store > the same data, but use a different format. > > Of course, LRT files with already broken strings (as a result of new > lines) would be initially mapped 1-to-1 to broken strings in RSJ file, > but they will get fixed the next time the form is re-saved. So users will need to save forms anyway in order to ensure strings correctness and to get correct .po files. Maybe some helper tool that resaves all affected forms in one go can be created, though. Don't know how big is demand for it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20160217/05d3afb4/attachment.html>

Reply by email

Mattias Gaertner
to Denis Kozlov
Show quoted text 5 lines
It would be useful to have a built-in option to regenerate base PO file (and update translated PO files) for a project. This could involve: 1) Removing all existing LRT, LRJ, RST, RSJ.

This can do that:
Run / Clean up and build

2) Forcing project to be recompiled to reprocess resourcestrings and produce RSJ

See above.

Mattias

Reply by email

Alfred
to Michael Schnell

Hello Michael,

My question has/had nothing to do with the "non Unicode application" thread.
Sorry for the confusion.

So, let me rephrase:

Would it be possible to add
{$MODE} DELPHIUNICODE / ISO / EXTENDEDPASCAL
to the syntax mode choices of the Lazarus (1.7) parsing options ?

Thanks !

Reply by email

Ondrej Pokorny
to Alfred
Alfred wrote 13 lines
Hello Michael, My question has/had nothing to do with the "non Unicode application" thread. Sorry for the confusion. So, let me rephrase: Would it be possible to add {$MODE} DELPHIUNICODE / ISO / EXTENDEDPASCAL to the syntax mode choices of the Lazarus (1.7) parsing options ? Thanks !

You have posted your question in the thread "Replacing LRT format with RSJ". Open a new thread for new questions.

Ondrej

Reply by email