Bug 265086 - Some strings are wrapped at ~ 80. char
Summary: Some strings are wrapped at ~ 80. char
Status: RESOLVED WORKSFORME
Alias: None
Product: lokalize
Classification: Unclassified
Component: editor (show other bugs)
Version: 1.2
Platform: openSUSE RPMs Linux
: NOR major with 1 vote (vote)
Target Milestone: ---
Assignee: Nick Shaforostoff
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2011-02-01 13:38 UTC by Fisiu
Modified: 2018-10-27 04:02 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Original .po file (200.32 KB, application/octet-stream)
2011-02-01 13:38 UTC, Fisiu
Details
Edited .po file (201.20 KB, application/octet-stream)
2011-02-01 13:42 UTC, Fisiu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fisiu 2011-02-01 13:38:04 UTC
Created attachment 56738 [details]
Original .po file

Version:           1.2 (KDE 4.6) (using KDE 4.6.0) 
OS:                Linux

Some strings from .po files, which are bit longer then one line, during saving .po file are divided into several lines. I tested in on some openSUSE localization file. I edited one char in first string. Then I saved this file and review the diff. A new .po file was messed up. File, before and after edit in attachment.

Reproducible: Always

Steps to Reproduce:
1. Create backup of tested .po file then open it in Lokalize 1.2
2. Do some minor changes and save file.
3. Review diff from backup and edited file.

Actual Results:  
Edited file is messed up, many strings are wrapped ~ 80. char.

Expected Results:  
Only "touched" Strings should be changed.
Comment 1 Fisiu 2011-02-01 13:42:14 UTC
Created attachment 56739 [details]
Edited .po file

I removed one char then added back in the first String to get save file possibility. This file should have changed only headers, not data!
Comment 2 Nick Shaforostoff 2011-04-11 14:18:21 UTC
SVN commit 1227648 by shaforo:

BUG:265086

Implement a hidden switch that allows to disable automatic msgfmt-like wordwrap at 80 char width.
To enable it add the following lines in the project .lokalize file:

[RegExps]
WordWrap=-1


(to be backported into 4.6)



 M  +15 -2     catalog/gettext/gettextexport.cpp  
 M  +2 -2      catalog/gettext/gettextstorage.cpp  
 M  +3 -0      project/projectbase.kcfg  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1227648
Comment 3 Nick Shaforostoff 2011-04-11 22:21:56 UTC
SVN commit 1227671 by shaforo:

BUG:265086

backport wordwrapping setting for those who consider this urgent



 M  +19 -2     catalog/gettext/gettextexport.cpp  
 M  +1 -2      catalog/gettext/gettextstorage.cpp  
 M  +3 -0      project/projectbase.kcfg  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1227671
Comment 4 Fisiu 2011-04-12 19:27:29 UTC
This doesn't work as it should. Can You do it to make lokalize work as version shipped with KDE 4.5? It was the last version which worked really good. When I set:
[RegExps]
WordWrap=-1

it still make some fuzzies while I edited totally different string:
 #: ../parser_misc.c:648
 #, c-format
 msgid "Internal error generated invalid perm 0x%llx\n"
-msgstr "Wewnętrzny błąd spowodował utworzenie nieprawidłowego uprawnienia 0x%llx\n"
+msgstr ""
+"Wewnętrzny błąd spowodował utworzenie nieprawidłowego uprawnienia 0x%llx\n"
 
 #: ../parser_misc.c:902 ../parser_symtab.c:563 ../parser_regex.c:744
 #: ../parser_variable.c:227
Comment 5 Nick Shaforostoff 2011-04-14 15:53:45 UTC
SVN commit 1227924 by shaforo:

BUG: 265086

make lokalize preserve PO formatting better when user asks it.
Fisiu: the 80 formatting change was done consiously, to make diffs for KDE l10n look cleaner.
In KDE a msgfmt is applied automatically to all PO files when they are updates to reflect new sources.

please check if the current state is fine for you. maybe some other important changes are needed.



 M  +24 -0     catalogitem.cpp  
 M  +4 -0      catalogitem.h  
 M  +2 -0      catalogitem_private.h  
 M  +11 -10    gettextexport.cpp  
 M  +1 -1      gettextexport.h  
 M  +9 -9      gettextimport.cpp  
 M  +2 -0      gettextimport.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1227924
Comment 6 Nick Shaforostoff 2011-04-14 15:54:30 UTC
(please compile from trunk)
Comment 7 Fisiu 2011-04-26 00:53:56 UTC
I tested r1229123. It still wraps all strings longer then 80 chars...
I run lokalize using:
lokalize --noprojectscan some_file.po

I re-saved some_file.po file and I got heavily modified file. Some proof:

#: help-install.html:383(li)
 #, fuzzy
 #| msgid "<placeholder-1/> -- switch on ACPI even if your BIOS is dated before 2000<br><placeholder-2/></br>"
-msgid "<placeholder-1/> -- switch on ACPI even if your BIOS is dated before 2000"
-msgstr "<placeholder-1/> - włącz ACPI nawet jeśli BIOS pochodzi sprzed roku 2000"
+msgid ""
+"<placeholder-1/> -- switch on ACPI even if your BIOS is dated before 2000"
+msgstr ""
+"<placeholder-1/> - włącz ACPI nawet jeśli BIOS pochodzi sprzed roku 2000" 

I did use no project config file at all. When I used a project file with options:
[RegExps]
WordWrap=-1

only source strings (msgid) are placed in a new line:
#: nautilus/libnautilus-private/apps_nautilus_preferences.schemas.in.h:107
-msgid "Set this to true if you are deploying a kiosk and don't want users to access the context menu in file views."
+msgid ""
+"Set this to true if you are deploying a kiosk and don't want users to access the context menu in file views."
 msgstr "W przypadku instalowania kiosku należy ustawić wartość \"true\", aby uniemożliwić użytkownikom dostęp do menu podręcznego."

msgstr look fine, as it should :)
Could You do the same 'hack' for msgid strings? If You need any other info, please let me know.
Comment 8 Nick Shaforostoff 2012-03-01 02:00:31 UTC
are you still experiencing misbehaviour with msgid modification?

i cannot reproduce it with Lokalize from KDE 4.8
Comment 9 Fisiu 2012-03-01 11:43:22 UTC
This bug is still valid for me. Tested with Lokalize 1.4 / KDE SC 4.8.0. I used the same file as attached in #c0. No matter what value of WordWrap is or even without it at all - after saving file, there are modified msgid and msgstr, which weren't touched in editor.
Comment 10 Nick Shaforostoff 2012-03-01 12:27:59 UTC
SVN commit 1283057 by shaforo:


fix word (non-)wrapping


also cleanup propjectmodel nodes on exit



 M  +8 -0      catalog/gettext/gettextimport.cpp  
 M  +3 -1      project/projectmodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1283057
Comment 11 Fisiu 2012-04-09 20:39:56 UTC
I tested recently Lokalize 1.4 with KDE 4.8.2 for short period of time, and finally [RegExps]
WordWrap=-1 put in .lokalize project file does the trick with wordwrapping.
Comment 12 Fisiu 2012-04-11 11:54:56 UTC
After more testing, I spot some weird behavior. If we have some String ready to translate with msgstr emty, after translation, our localized string is put in a new line:

#: src/vminstall/msg.py:283
 msgid "Paravirtualized PXE booting requires the use of tftp or atftp.  Please install one of these packages."
 msgstr ""
+"Parawirtualne bootowanie PXE wymaga użycia tftp lub aftp. Należy zainstalować jeden z tych pakietów."

Any chance to improve it, to put localized String directly after msgstr, not in a new line?

Regards,
Mariusz
Comment 13 Fisiu 2012-04-24 15:07:11 UTC
I noticed something weird with this setting. Sometimes new line markers '\n' are missing after saving .po file. `msgfmt -cv file.po` gives error with incorrect \n count between msgid and msgstr.

Now I set WordWrap=10000 in project config file to avoid wrapping msgid and msgstr (until some string have more then 10k chars). But it needs some more tests.
Comment 14 Nick Shaforostoff 2012-04-24 18:30:50 UTC
can you give me exact msgstrs which produce incorrect results in terms of \n?
Comment 15 Adrián Chaves (Gallaecio) 2012-07-08 13:29:31 UTC
This could be closed as Needs Info.
Comment 16 Chao Feng 2013-05-06 12:40:16 UTC
Change to NeedsInfo because reporter do not reply after a long time.
Comment 17 Andrew Crouthamel 2018-09-24 02:23:59 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 18 Andrew Crouthamel 2018-10-27 04:02:27 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!