Sign in Join

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

Mailing lists / pas2js / 2019-07

Translating using resource strings

6 messages · 2 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,

I've added a unit that presents you with an API to translate the resource strings in your program.

The unit is called rstranslate. You can

1. Load a translation for a single resource string.

2. Load an object with a list of units/strings that must be translated in a simple format.

3. Specify an URL of a file which contains the translations. The file will be loaded, the object parsed and used to translate using mechanism 2. Since this is an async operation, there is a callback to notify you when the translation is done.

4. Reset the resource strings to their original values for one string or all strings of a unit.

For each of the cases there is a demo in the folder demo/translate. You can click the translate button twice : every even click will reset the translation, allowing you to switch between 2 languages.

The implementation is just a sample which should cover most use cases. You can perfectly create your own alternative mechanism, of course.

Still planned is to let the compiler generate a file (in the same format as used by this API) with the default values of the strings as found in the program source file(s).

Michael.

Reply by email

Pedro Pablo Oviedo Vera
to Michael Van Canneyt

Hello friends, I am new in Pas2js, I want begin to learn about it and then contribute to the project but I need a starting point, any help please..

2019-07-15 9:05 GMT-04:00, Michael Van Canneyt :

Show quoted text 38 lines
Hello, I've added a unit that presents you with an API to translate the resource strings in your program. The unit is called rstranslate. You can 1. Load a translation for a single resource string. 2. Load an object with a list of units/strings that must be translated in a simple format. 3. Specify an URL of a file which contains the translations. The file will be loaded, the object parsed and used to translate using mechanism 2. Since this is an async operation, there is a callback to notify you when the translation is done. 4. Reset the resource strings to their original values for one string or all strings of a unit. For each of the cases there is a demo in the folder demo/translate. You can click the translate button twice : every even click will reset the translation, allowing you to switch between 2 languages. The implementation is just a sample which should cover most use cases. You can perfectly create your own alternative mechanism, of course. Still planned is to let the compiler generate a file (in the same format as used by this API) with the default values of the strings as found in the program source file(s). Michael. _______________________________________________ Pas2js maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
MSc. Ing. Pedro Pablo Oviedo Vera Dirección Técnica y Desarrollo Empresa de Proyectos e Ingeniería del Ministerio de la Agricultura.ENPA. Boyeros y Conill, Piso 10 Edif MINAG Telef. 884 7197 SIP:23000116

Reply by email

Michael Van Canneyt
to Pedro Pablo Oviedo Vera
Pedro Pablo Oviedo Vera wrote
Hello friends, I am new in Pas2js, I want begin to learn about it and then contribute to the project but I need a starting point, any help please..

Why not try the demos ? There are lots of them, they are in the installation zip.

Do you need something else ?

Michael.

Reply by email

Pedro Pablo Oviedo Vera
to Michael Van Canneyt

Sorry, Iam realy new....I need to know something like if this demo is possible run from Lazarus IDE or from fpide...if I need specific configuration to installa any package with pas2js componets or simply config path to units source code....really from 0 ...please

El jue., 18 jul. 2019 a las 12:32, Michael Van Canneyt (<

Show quoted text 21 lines
) escribió: On Wed, 17 Jul 2019, Pedro Pablo Oviedo Vera wrote: > Hello friends, I am new in Pas2js, I want begin to learn about it and > then contribute to the project but I need a starting point, any help > please.. Why not try the demos ? There are lots of them, they are in the installation zip. Do you need something else ? Michael. _______________________________________________ Pas2js maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
MSc. Ing. Pedro Pablo Oviedo Vera Dirección Técnica y Desarrollo Empresa de Proyectos e Ingeniería del Ministerio de la Agricultura.ENPA. Boyeros y Conill, Piso 10 Edif MINAG Telef. 884 7197 SIP:23000116 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20190722/7494596b/attachment.html>

Reply by email

Michael Van Canneyt
to Pedro Pablo Oviedo Vera
Pedro Pablo Oviedo Vera wrote
Sorry, Iam realy new....I need to know something like if this demo is possible run from Lazarus IDE or from fpide...if I need specific configuration to installa any package with pas2js componets or simply config path to units source code....really from 0 ...please

Please start with reading:

https://wiki.freepascal.org/pas2js

and

https://wiki.freepascal.org/lazarus_pas2js_integration

It describes what must be done.

Basically:

1. you must download and unzip the pas2js distribution.

2. To work with lazarus you must install the pas2js_dsgn package in the IDE, and tell the IDE where you put the pas2js binary, as described in the second page referred to above.

(Lazarus packages are described here:
https://wiki.freepascal.org/Lazarus_Packages)

After that, you can start coding in Lazarus. But you can also simply use notepad++ or some other editor if you prefer.

You cannot use pas2js from fpide.

Michael.

Show quoted text 35 lines
El jue., 18 jul. 2019 a las 12:32, Michael Van Canneyt (< >) escribió: > > > > On Wed, 17 Jul 2019, Pedro Pablo Oviedo Vera wrote: > >> Hello friends, I am new in Pas2js, I want begin to learn about it and >> then contribute to the project but I need a starting point, any help >> please.. > > Why not try the demos ? There are lots of them, they are in the > installation zip. > > Do you need something else ? > > Michael. > _______________________________________________ > Pas2js maillist - > https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js > -- MSc. Ing. Pedro Pablo Oviedo Vera Dirección Técnica y Desarrollo Empresa de Proyectos e Ingeniería del Ministerio de la Agricultura.ENPA. Boyeros y Conill, Piso 10 Edif MINAG Telef. 884 7197 SIP:23000116

Reply by email

Pedro Pablo Oviedo Vera
to Michael Van Canneyt

Yes....thanks for your help I did my first step with pas2js..now Iam on my way...

El mar., 23 jul. 2019 a las 5:03, Michael Van Canneyt (<

Show quoted text 78 lines
) escribió: On Mon, 22 Jul 2019, Pedro Pablo Oviedo Vera wrote: > Sorry, Iam realy new....I need to know something like if this demo is > possible run from Lazarus IDE or from fpide...if I need specific > configuration to installa any package with pas2js componets or simply > config path to units source code....really from 0 ...please Please start with reading: https://wiki.freepascal.org/pas2js and https://wiki.freepascal.org/lazarus_pas2js_integration It describes what must be done. Basically: 1. you must download and unzip the pas2js distribution. 2. To work with lazarus you must install the pas2js_dsgn package in the IDE, and tell the IDE where you put the pas2js binary, as described in the second page referred to above. (Lazarus packages are described here: https://wiki.freepascal.org/Lazarus_Packages) After that, you can start coding in Lazarus. But you can also simply use notepad++ or some other editor if you prefer. You cannot use pas2js from fpide. Michael. > > El jue., 18 jul. 2019 a las 12:32, Michael Van Canneyt (< > >) escribió: > >> >> >> >> On Wed, 17 Jul 2019, Pedro Pablo Oviedo Vera wrote: >> >>> Hello friends, I am new in Pas2js, I want begin to learn about it and >>> then contribute to the project but I need a starting point, any help >>> please.. >> >> Why not try the demos ? There are lots of them, they are in the >> installation zip. >> >> Do you need something else ? >> >> Michael. >> _______________________________________________ >> Pas2js maillist - >> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js >> > > > -- > > MSc. Ing. Pedro Pablo Oviedo Vera > Dirección Técnica y Desarrollo > Empresa de Proyectos e Ingeniería del > Ministerio de la Agricultura.ENPA. > Boyeros y Conill, Piso 10 Edif MINAG > Telef. 884 7197 > SIP:23000116 >_______________________________________________ Pas2js maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
MSc. Ing. Pedro Pablo Oviedo Vera Dirección Técnica y Desarrollo Empresa de Proyectos e Ingeniería del Ministerio de la Agricultura.ENPA. Boyeros y Conill, Piso 10 Edif MINAG Telef. 884 7197 SIP:23000116 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20190730/5558bc1b/attachment.html>

Reply by email