webERP Forum
Edit a Language File Module - Blank Strings - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (/forumdisplay.php?fid=1)
+--- Forum: Problems / Bugs? (/forumdisplay.php?fid=8)
+--- Thread: Edit a Language File Module - Blank Strings (/showthread.php?tid=7919)

Pages: 1 2


Edit a Language File Module - Blank Strings - VortecCPI - 11-17-2017 08:14 AM

From Main Menu > Maintain Language Files > Edit a Language File Module > CustItem.php

Some Default Text entries are blank and it appears this is due to the first line of msgid being "" in the messages.po file. There are quite few occurrences of this in the messages.po file so I am not sure if this is by design and if the issue is with that file or the Z_poEditLangModule.php file.

[attachment=548]

[attachment=549]


RE: Edit a Language File Module - Blank Strings - falkoner - 11-17-2017 06:48 PM

To be honest I wouldn't recommend using these Z_po files at all. They are old and in need of some TLC. I tried many years ago to get them working properly but there were incidents where people lost work and in the end whilst I like the idea of them I think it is better to use poedit - https://poedit.net/

Tim


RE: Edit a Language File Module - Blank Strings - VortecCPI - 11-17-2017 09:45 PM

Thank you Tim.

Okay... So same bucket as before when I had issues with the .mo files being updated. So...

Edit the .po file manually and then

msgfmt path-to-weberp/locale/en_US.utf8/LC_MESSAGES/messages.po

The only comment I have would be that novice users who know little or nothing about Linux may find this difficult.

Also... That being said we get what we pay for and with webERP we get A LOT for our money so no complaint here.


RE: Edit a Language File Module - Blank Strings - falkoner - 11-18-2017 03:40 AM

poedit does have the facility to compile the messages.mo file directly from it's interface. so you shouldn't need to use msgfmt.

I believe there is a windows version available as well, though not being a windows user I can't confirm how good that client is.

Tim


RE: Edit a Language File Module - Blank Strings - VortecCPI - 12-03-2017 01:52 AM

I cleaned up the standard included US version of the PO file by removing lines with just msgid "" and combining them with the lines below.

So this:
#: AccountGroups.php:19
msgid ""
"An error occurred in retrieving the account groups of the parent account "

"group during the check for recursion"
msgstr ""

Becomes this:
#: AccountGroups.php:19
msgid "An error occurred in retrieving the account groups of the parent account "
"group during the check for recursion"
msgstr ""

Before and after:

[attachment=587] [attachment=586]

Note all the blank lines now have data. I wrote a small utility to take care of this so if other files suffer the same I can fix them on request.


RE: Edit a Language File Module - Blank Strings - VortecCPI - 12-03-2017 05:57 AM

Okay so next issue... The problem continues with lines stacked one on top of the other as show below:

#: AccountGroups.php:19
msgid "An error occurred in retrieving the account groups of the parent account "
"group during the check for recursion"

msgstr ""

Must be THIS to show correctly:

#: AccountGroups.php:19
msgid "An error occurred in retrieving the account groups of the parent account group during the check for recursion"
msgstr ""

I am updating my utility to cure it now...

Okay so now before and after:
[attachment=588]

The EN_GB PO file only has single lines but the EN_US PO file has the lines split so something must have gone wrong during the translation.

New zip file attached for baseline EN_US locale.


RE: Edit a Language File Module - Blank Strings - falkoner - 12-03-2017 06:08 AM

There is a setting when running xgettext that stops this happening but only have my phone with me so can't recall what it is.

Tim


RE: Edit a Language File Module - Blank Strings - VortecCPI - 12-03-2017 07:12 AM

I see "--no-wrap" in the command lines but I believe that is only for building the MO file.

36 > $xgettextCmd = 'xgettext --no-wrap -L php -o ' . $PathToDefault . ' ' . $FilesToInclude;

41 > $msgMergeCmd = 'msgmerge --no-wrap --update ' . $PathToLanguage . ' ' . $PathToDefault;


RE: Edit a Language File Module - Blank Strings - phil - 12-04-2017 06:57 AM

The .po files are created by a gettext utility - to get all the strings in the code encapsulated in the gettext function _() and then re-merged with the existing translation.
The script to create the merged/updated translation files is under build/make_release.sh

Code:
xgettext --no-wrap --from-code=utf-8 --language=PHP -o locale/en_GB.utf8/LC_MESSAGES/messages.pot *php includes/*.php includes/*.inc reportwriter/*.php reportwriter/*.inc reportwriter/forms/*.html reportwriter/admin/*.php reportwriter/admin/*.inc reportwriter/admin/forms/*.html api/*.php install/*.php ../webSHOP/*.php ../webSHOP/includes/*.php
.
.
.
then
Code:
msgmerge -U -N --backup=off locale/en_US.utf8/LC_MESSAGES/messages.po locale/en_GB.utf8/LC_MESSAGES/messages.pot

and this is run before each release so the .po files always have all the latest strings in them.
I guess we need to figure out the correct syntax of the msgmerge utility to avoid the empty msgid lines
Perhaps the no-wrap parameter to msgmerge might do it.


RE: Edit a Language File Module - Blank Strings - falkoner - 12-04-2017 09:06 AM

Phil is right that the no-wrap parameter is needed on msmerge as well as xgettext, but if I remember correctly if the file you are merging into already has the line breaks then they will persist after the merge regardless of this setting. Though my knowledge is a few years old so it may have changed, but it sounds from what Paul is saying that this is still the case.

I do remember writing a bash script to remove these, but I have had a quick look around and can't immediately see this so it may have got lost on one of my laptop thefts or hard disk crashes Sad

Tim