Sign in Join

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

Mailing lists / lazarus / 2008-02

Resource strings

9 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Alex du Plessis

Hello list

I have an application which implements resource sections. When I compile, only the main file .po file is created and not a .po file for the unit in which the resourcestring section resides.

On opening the main file.po there seems to be a random selection of variable names e.g. 'Combobox1','Edit1' and some (not all) captions of forms present. No sign of my strings in the resourcestring section.

Any ideas about what I could be doing wrong?

Reply by email

Graeme Geldenhuys
to Alex du Plessis
Alex du Plessis wrote 5 lines
Hello list I have an application which implements resource sections. When I compile, only the main file .po file is created and not a .po file for the unit in which the resourcestring section resides.

Compiling a project that uses the resourcestring section doesn't create .po files. It creates *.rst files. You first need to run a conversion tool to get it into a .po file format.

eg:
rstconv -i uitext.rst -o languages/uitext.po

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Alex du Plessis
to Graeme Geldenhuys
Graeme Geldenhuys wrote 20 lines
On 21/02/2008, Alex du Plessis wrote: > Hello list > > I have an application which implements resource sections. When I > compile, only the main file .po file is created and not a .po file for > the unit in which the resourcestring section resides. > Compiling a project that uses the resourcestring section doesn't create .po files. It creates *.rst files. You first need to run a conversion tool to get it into a .po file format. eg: rstconv -i uitext.rst -o languages/uitext.po Regards, - Graeme -

Once again caught on my own stupidity. Thanx Graeme.

Reply by email

Mattias Gaertner
to Alex du Plessis
Show quoted text 8 lines
Graeme Geldenhuys wrote: > On 21/02/2008, Alex du Plessis wrote: > >> Hello list >> >> I have an application which implements resource sections. When I >> compile, only the main file .po file is created and not a .po >> file for the unit in which the resourcestring section resides.

check IDE / Project / Project options / i18n / enable i18n and set a subdirectory. For example 'languages'.

Show quoted text 6 lines
> Compiling a project that uses the resourcestring section doesn't > create .po files. It creates *.rst files. You first need to run a > conversion tool to get it into a .po file format. > > eg: > rstconv -i uitext.rst -o languages/uitext.po

In the old days.

Mattias

Reply by email

Alex du Plessis
to Mattias Gaertner

That is exactly what I did (using Project/Project Options/il8n/enable il8n) initially and that is when I got the jumbled (and unwanted) strings from it seems my .lpr file. No .mo file associated with my unit file that contains the resource strings. The .rst file for the unit file did get created though and using rstconv still works.

I am running on WinXP with the snapshot from 20/02/2008. I know that the enable il8n option worked in previous snapshots, but something seems to have changed. I did a completely new(clean) install of Lazarus using a new directory and it still does the same.Maybe something wrong in my project file? It still compiles without a hitch though.

Mattias Gaertner wrote 34 lines
On Thu, 21 Feb 2008 09:55:00 +0200 Alex du Plessis wrote: > Graeme Geldenhuys wrote: > >> On 21/02/2008, Alex du Plessis wrote: >> >> >>> Hello list >>> >>> I have an application which implements resource sections. When I >>> compile, only the main file .po file is created and not a .po >>> file for the unit in which the resourcestring section resides. >>> check IDE / Project / Project options / i18n / enable i18n and set a subdirectory. For example 'languages'. >> Compiling a project that uses the resourcestring section doesn't >> create .po files. It creates *.rst files. You first need to run a >> conversion tool to get it into a .po file format. >> >> eg: >> rstconv -i uitext.rst -o languages/uitext.po >> In the old days. Mattias

Reply by email

Mattias Gaertner
to Alex du Plessis
That is exactly what I did (using Project/Project Options/il8n/enable il8n) initially and that is when I got the jumbled (and unwanted) strings from it seems my .lpr file.

Why unwanted? These are the strings of your forms.

No .mo file associated with my unit file that contains the resource strings. The .rst file for the unit file did get created though and using rstconv still works.

.mo files are only needed by gettext. The .po files can be read directly by the LCL translation unit, so no need for lazarus to create mo files.

Show quoted text 6 lines
I am running on WinXP with the snapshot from 20/02/2008. I know that the enable il8n option worked in previous snapshots, but something seems to have changed. I did a completely new(clean) install of Lazarus using a new directory and it still does the same.Maybe something wrong in my project file? It still compiles without a hitch though.

Mattias

Reply by email

Tomasz Wojtyś
to Mattias Gaertner: On Thu, 21 Feb 2008 09:55:00 +0200 check IDE / Project / Project options / i18n / enable…
Show quoted text 7 lines
> >> I have an application which implements resource sections. When I > >> compile, only the main file .po file is created and not a .po > >> file for the unit in which the resourcestring section resides. check IDE / Project / Project options / i18n / enable i18n and set a subdirectory. For example 'languages'.

I have a problem with translations too.

var
  _PODirectory, _Lang, _FallbackLang: string;
begin
  _PODirectory := 'po/';
  GetLanguageIDs (_Lang, _FallbackLang);
  TranslateUnitResourceStrings ('Lang', _PODirectory + 'puzle.%s.po',
                                _Lang, _FallBackLang);
...

where the Lang is an unit contains resource-strings.

I take generated puzle.po, rename it to, for exaple puzle.pl.po, and translate. Later I added some strings in application and the new puzle.po file was generated. How can I update my translation in puzle.pl.po?

Tomasz Wojty?

Reply by email

Mattias Gaertner
to Tomasz Wojtyś
Show quoted text 26 lines
> > >> I have an application which implements resource sections. > > >> When I compile, only the main file .po file is created and not > > >> a .po file for the unit in which the resourcestring section > > >> resides. > > check IDE / Project / Project options / i18n / enable i18n > and set a subdirectory. For example 'languages'. > I have a problem with translations too. var _PODirectory, _Lang, _FallbackLang: string; begin _PODirectory := 'po/'; GetLanguageIDs (_Lang, _FallbackLang); TranslateUnitResourceStrings ('Lang', _PODirectory + 'puzle.%s.po', _Lang, _FallBackLang); ... where the Lang is an unit contains resource-strings. I take generated puzle.po, rename it to, for exaple puzle.pl.po, and translate. Later I added some strings in application and the new puzle.po file was generated. How can I update my translation in puzle.pl.po?

/path/to/lazarus/tools/updatepofiles originalpofile.po

This will update all originalpofile.*.po

Eventually this function will be executed by the IDE.

Mattias

Reply by email

Graeme Geldenhuys
to Tomasz Wojtyś: I have a problem with translations too. var _PODirectory, _Lang, _FallbackLang: string;…
Tomasz Wojty? wrote
translate. Later I added some strings in application and the new puzle.po file was generated. How can I update my translation in puzle.pl.po?

And again Lazarus comes to the rescue. In the <lazarus>/tools directory, there is a updatepofiles.pas unit. Compile and run that agains your .po files.

From the source headers:

Name:
updatepofiles - updates po files.

Synopsis:
updatepofiles filename1.po [filename2.po ... filenameN.po]

Description:
updatepofiles deletes doubles in the po file and merges new strings into all translated po files (filename1.po.xx)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email