[Lazarus] Resource strings and newline

Václav Valíček vaclav at valicek.name
Thu Jun 19 09:27:01 CEST 2014


Yes, it could be problem. I was writing #13#10 under windows, but when I 
started to rewrite localizations in some of my sources, I'm using

resourceString = 'This is multiline' + sLineBreak +
     'resourcestring.'

I think that to type new line after sLineBreak, LineEnding etc. Is very 
good for code readablity... At least for long texts...

Václav Valíček
vaclav at valicek.name

Dne 19.6.2014 07:07, Péter Gábor napsal(a):
> I asked about different LineEndigs because of the resourcestrings which
> are written by developers working on different operating systems.
> They may put different LineEnding in resourcestrings if they don't use
> the LineEnding constant, but writing #13#10 or #10 or #13 as it is usual
> on their system. In this case the compiler on an other system may not
> accept the hardcoded line ending as it is wished by the developer.
>
> If the string 'Linux#10is great!' will be compiled on Linux it will
> become 'Linux \n is great!' but when compiling on windows it will not
> have the \n in it.
>
> If the string is written like this: 'Linux'+LineEnding+' great!' will be
> compiled on both systems to 'Linux \n is great!'
>
> Using #10 instead of +LineEnding+ is faster so I think a lot of
> developers will use this to insert new line marker in their strings.
>
> 2014-06-18 19:56 keltezéssel, Sven Barth írta:
>> Am 18.06.2014 18:32 schrieb "Péter Gábor" <ptrg at freemail.hu
>> <mailto:ptrg at freemail.hu>>:
>>>
>>>
>>> 2014-06-18 09:44 keltezéssel, Mattias Gaertner írta:
>>>> In the old days special characters were not converted properly.
>>>>
>>>> I just tested:
>>>>
>>>> 'A'#10'BC' is converted to
>>>> msgid ""
>>>> "A\n"
>>>> "BC\n"
>>>>
>>>> Note the new line behind BC. When this is fixed, I can adapt the 'Make
>>>> resourcestring dialog'.
>>>>
>>>> Also all line breaks (#10, #13, #13#10) are converted to \n and on
>>>> loading to the system line break. That's ok for all strings
>>>> passed to the LCL, but all other must be checked manually.
>>>>
>>>> Mattias
>>> What is about that all systems has its own LineEnding?
>>> eg.: a single #10 or a single #13 is not marking EOL on windows, #13 is
>>> not marking EOL on Linux, etc.
>> \n is automatically converted using the LineEnding variable when the
>> PO-reader parses it. So you are only out of luck if you want a
>> resourcestring that should contain e.g. #13#10 on e.g. a Linux system.
>>
>> Regards,
>> Sven





More information about the Lazarus mailing list