[lazarus] Two FPC questions

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Sep 11 05:56:30 EDT 2002




On Wed, 11 Sep 2002, Michal Bukovjan wrote:

> Marco van de Voort wrote:
>
> >>>- this would not break existing string/shortstring/ansistring semantics
> >>>
> >>>
> >>It would. If by any chance there is a '\n' in existing code, for
> >>instance in a constant descibing a unix shell command, then this will be
> >>broken.
> >>
> >>
> >
> >Or simply a win32 path.
> >c:\new windows
> >
> >We could simply define a tab char, and crlf is already defined afaik.
> >
> The escaping could be handled by switches, as suggested. That would be
> perfectly OK, by default escaping would be off, so no breakage.
>
> >
> >So one should simply use
> >
> >'bla'+tab+'bla2';
> >
> >
> So how do you these translate (Pascal) expressions with standard
> (gettext) tools?
> How do you generate .po files then?

The rst2po tool takes care of this translation.

> What about platform independent .lfm files, that contain multiline strings?

This will fail anyhow, since you will get the string as it was compiled,
ie.  compiled on linux will result in a #10, on windows in a #13#10.

>
> Sure, some of this can be written with function, with no extra support
> from language. Slow, awkward, but can be. At least these could be
> included SysUtils, then... But I think one cannot use a function for
> resourcestrings, so again, a dead end.

This is not true.

The solution is very simple; have a look at the existing gettext support.
(unit gettext)
You can transform the resourcestrings at program startup as part of the
gettext support. This way you can store whatever you want in the
resourcestring. At program startup, when localizing, the strings are
translated and transformed on the fly...

See also the programmer's manual, the resource string support is covered
extensively.


>
> To my knowledge, all major languages support this, be it Python, Java,
> C, C++, Perl. Pascal does not support this, but I would not call it a
> feature, rather a design flaw.

No, because normally you don't need this.

>
> But maybe I am missing something; maybe the issue is more complicated
> than it seems. You are the wizards :-)
>
> Does anyone know how Borland handles translations?

It doesn't do any as far as I know.

Michael.






More information about the Lazarus mailing list