Sign in Join

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

Mailing lists / pas2js / 2019-07

Resource strings, part 2

10 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Michael Van Canneyt

Hello,

The compiler now can generate (as FPC itself does) a file with all the resource strings in your unit or program.

The generating of this file is controlled by the new -Jr option. It can take 3 possible arguments:

none: This is the default, no file is generated.
unit: one file per compiled unit will be generated. This file will contain all resource strings of the unit. program: one file is generated for the main file. This fill will contain all used resource strings for the main file and all the units it uses.

If you compile a program, then the program option will generate a file with all the used resource strings in your program.

The rstranslate unit (announced earlier this week) can read this (translated) file and translate all resource strings.

This is not yet in fixes, just in trunk.

See also:
https://wiki.freepascal.org/pas2js#Resource_strings

Michael.

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 17 lines
On Sat, 20 Jul 2019 14:13:45 +0200 (CEST) Michael Van Canneyt wrote: > Hello, > > The compiler now can generate (as FPC itself does) a file with all > the resource strings in your unit or program. Great! > [...] > See also: > https://wiki.freepascal.org/pas2js#Resource_strings The format does not look like fpc's rsj. Why has it the same extension?

Because it is a logical extension.

How else would you abbreviate "Resource String JSON"

We can of course make it JSON Resource String - .jrs - to avoid confusion.

Michael.

Reply by email

Mattias Gaertner
to Michael Van Canneyt
Show quoted text 21 lines
On Sat, 20 Jul 2019, Mattias Gaertner via Pas2js wrote: > On Sat, 20 Jul 2019 14:13:45 +0200 (CEST) > Michael Van Canneyt wrote: > >> Hello, >> >> The compiler now can generate (as FPC itself does) a file with all >> the resource strings in your unit or program. > > Great! > > >> [...] >> See also: >> https://wiki.freepascal.org/pas2js#Resource_strings > > The format does not look like fpc's rsj. Why has it the same > extension? Because it is a logical extension.

IMO the above wiki page should explain shortly why pas2js is not using fpc's format and what tools translators can use.

How else would you abbreviate "Resource String JSON" We can of course make it JSON Resource String - .jrs - to avoid confusion.

+1

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 27 lines
On Sat, 20 Jul 2019 15:15:13 +0200 (CEST) Michael Van Canneyt wrote: > On Sat, 20 Jul 2019, Mattias Gaertner via Pas2js wrote: > > > On Sat, 20 Jul 2019 14:13:45 +0200 (CEST) > > Michael Van Canneyt wrote: > > > >> Hello, > >> > >> The compiler now can generate (as FPC itself does) a file with all > >> the resource strings in your unit or program. > > > > Great! > > > > > >> [...] > >> See also: > >> https://wiki.freepascal.org/pas2js#Resource_strings > > > > The format does not look like fpc's rsj. Why has it the same > > extension? > > Because it is a logical extension. IMO the above wiki page should explain shortly why pas2js is not using fpc's format and what tools translators can use.

I explained why.

As soon as tools for translators appear, they will be added to the page.

This could in fact be a nice contribution: write a small web-based tool to translate a .jrs file.

Show quoted text 6 lines
> How else would you abbreviate "Resource String JSON" > > We can of course make it JSON Resource String - .jrs - to avoid > confusion.

Done.

Michael.

Reply by email

warleyalex
to Michael Van Canneyt

For instance, when you compile a program,

pas2js -Jrprogram data.pp -B

It will generate an external file, e.g. "data.jrs", with all used resource strings for the main file and all the units it uses.

Now, let's suppose, when you compile a program, with the option

pas2js -Jrprogram data.pp -MainHTML

...the compiler it will auto add inline JSON data at main HTML file for you, all the used resource strings (*.jrs), all forms streams (*.wfm), the compiler will generate several script type ="application/json" for each resource with custom data/id tag.

Reply by email

Michael Van Canneyt
to warleyalex: For instance, when you compile a program, pas2js -Jrprogram data.pp -B It will generate…
warleyalex wrote 15 lines
For instance, when you compile a program, pas2js -Jrprogram data.pp -B It will generate an external file, e.g. "data.jrs", with all used resource strings for the main file and all the units it uses. Now, let's suppose, when you compile a program, with the option pas2js -Jrprogram data.pp -MainHTML ...the compiler it will auto add inline JSON data at main HTML file for you, all the used resource strings (*.jrs), all forms streams (*.wfm), the compiler will generate several script type ="application/json" for each resource with custom data/id tag.

The compiler itself will not emit HTML.

But you can use the postprocessor feature for this kind of thing, that is why it was added. If necessary we can add some arguments to that or create a kind of 'linker' file containing collected info about the generated files.

This kind of thing is exactly what TMS Web core does: it wraps extra functionality around the compiler.

Michael.

Reply by email