View Issue Details

IDProjectCategoryView StatusLast Update
0026616LazarusLCLpublic2014-08-26 01:35
ReporterDenis KozlovAssigned ToMaxim Ganetsky 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindowsOSOS Version
Product Version1.2.4Product BuildLazarus 1.2.4 r45510 FPC 2.6.4 
Target VersionFixed in Version1.4 
Summary0026616: New lines produce fuzzy noise in updated PO files
DescriptionCertain new line styles cause false fuzzy entries added to updated PO files, accumulating noise for every update.

The conditions are:
1) Resource strings contain non system default line styles (system - is where we compile project and update PO files).
2) PO files that are being updated have non-empty translation in entries that contain new line characters.

The root cause seems to be in TPOFile.UpdateItem, where CompareMultilinedStrings and SkipLineEndings are mismatching some new line styles. I have only investigated PO files, so don't know if MO files are affected too.

In the example (in additional info), notice the accumulation of fuzzy msgid entries. This test was on Windows, so on other platforms probably different new line styles will get affected. So far the best workaround seems to be using only the system default new line style in resource strings, i.e. sLineBreak or LineEnding.

If it's not worth fixing, perhaps it should at least be mentioned in the documentation.
Additional InformationFor example, if we have the following resource strings (using LF [0x0A] and CR [0x0D], because of how Mantis treats hash symbol):

  RS1 = 'A' + CRLF + CRLF + 'B'; // Windows style
  RS2 = 'A' + LFCR + LFCR + 'B';
  RS3 = 'A' + CR + CR + 'B'; // Mac OS style up to v9
  RS4 = 'A' + LF + LF + 'B'; // Unix style
  
(http://en.wikipedia.org/wiki/Newline#Representations)

Create a copy of auto-generated PO file (e.g. name it project1.en.po) and fill with dummy translations:
-------------------------
#: unit1.rs1
msgid ""
"A\n"
"\n"
"B\n"
msgstr "a"

#: unit1.rs2
msgid ""
"A\n"
"\n"
"\n"
"B\n"
msgstr "b"

#: unit1.rs3
msgid ""
"A\n"
"\n"
"B\n"
msgstr "c"

#: unit1.rs4
msgid ""
"A\n"
"\n"
"B\n"
msgstr "d"
-------------------------

Now, force update of PO files a couple of times by adding or changing another resource string, the effect is:
-------------------------
#: unit1.rs1
msgid ""
"A\n"
"\n"
"B\n"
msgstr "a"

#: unit1.rs2
msgid ""
"A\n"
"\n"
"\n"
"B\n"
msgstr "b"

#: unit1.rs3
#, fuzzy
#| msgid ""
#| "A\n"
#| "\n"
#| "B\n"
#| "A\n"
#| "\n"
#| "B\n"
#| "A\n"
#| "\n"
#| "B\n"
msgid ""
"A\n"
"\n"
"B\n"
msgstr "c"

#: unit1.rs4
msgid ""
"A\n"
"\n"
"B\n"
msgstr "d"
-------------------------
Tagsfuzzy, msgid, PO
Fixed in Revision46076
LazTarget-
Widgetset
Attached Files

Activities

Maxim Ganetsky

2014-08-26 01:35

developer   ~0076718

Please test and close if OK.

Issue History

Date Modified Username Field Change
2014-08-19 14:56 Denis Kozlov New Issue
2014-08-19 14:57 Denis Kozlov Tag Attached: PO
2014-08-19 14:57 Denis Kozlov Tag Attached: fuzzy
2014-08-19 14:57 Denis Kozlov Tag Attached: msgid
2014-08-19 22:38 Maxim Ganetsky Relationship added related to 0026553
2014-08-19 22:38 Maxim Ganetsky LazTarget => -
2014-08-19 22:38 Maxim Ganetsky Status new => confirmed
2014-08-26 01:35 Maxim Ganetsky Fixed in Revision => 46076
2014-08-26 01:35 Maxim Ganetsky Note Added: 0076718
2014-08-26 01:35 Maxim Ganetsky Status confirmed => resolved
2014-08-26 01:35 Maxim Ganetsky Fixed in Version => 1.4
2014-08-26 01:35 Maxim Ganetsky Resolution open => fixed
2014-08-26 01:35 Maxim Ganetsky Assigned To => Maxim Ganetsky
2014-10-10 00:26 Maxim Ganetsky Relationship deleted related to 0026553