Forum > Translations

Translating resource strings from FCL units

<< < (2/3) > >>

prof7bit:
Let me state this problem differently:

Suppose I am an FPC develoer or working on an FPC package, and I want to provide i18n files for my packages or units. How would I go about leveraging Lazarus i18n features for generating and maintaining my translation files?

I can open for example the FCL package in the package manager and enable "i18n", but this seems to be meaningless, I cannot recompile these packages from within Lazarus, it will just do nothing.

Is this the reason why FPC does not provide any language files? Because they have zero IDE support?

Sieben:
For a start I did:

- copy rtlconsts.pp, rtlconst.inc and sysconst.pp form rtl/objpas to a new directory

- rename those files with some prefix to avoid confusion (don't forget to adjust unit names and dependencies)

- create a new package and include these files, enable i18n and compile

- edit the po files to rename their identifiers, at least those in msgctxt entries (others are just comments)*.

Now translate a string, say SListIndexError from rtlconsts, create a new project, include your rtlconsts.xx.po as you mentioned above and provoke a 'List index out of bounds' with eg TStringList to test it. Worked for me. Should work for any other file containing fpc resourcestrings as well. If they can not be compiled 'stand alone' due to dependencies just copy their resourcestring sections to a new unit and adjust their po name and identifiers according to the original unit name. I'm including rtlconsts.po and sysconst.po generated as mentioned above.

* Not sure yet if identifiers of rtlconsts.po have to be rtlconsts.xxx or rtlconst.xxx, according to inc-file name.

marcov:
Afaik the input for translation of the FPC embedded strings goes with the "*.rsj" files generated during compilation. (used to be ".rst" in older versions).

If the tools to convert them to gettext are there, I don't know, but it probably your raw input

Sieben:
I also noticed this ifdef in classes.inc:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$IFDEF LANG_GERMAN}{$i constsg.inc}{$ELSE}{$IFDEF LANG_SPANISH}{$i constss.inc}{$ENDIF}{$ENDIF} 
but don't know if this is still used. Although using a german setup these strings seem not be translated here. The files mentioned are in place, dated 2005 however.

Wouldn't it be worth considering a similar approach as Lazarus uses for LCLStrConsts for FPC sources as well...?

marcov:
Afaik those includes predate resourcestring support.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version