Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Edit a Language File Module - Blank Strings
11-17-2017, 08:14 AM, (This post was last modified: 11-17-2017, 08:15 AM by VortecCPI.)
#1
Edit a Language File Module - Blank Strings
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.

   

   
https://www.linkedin.com/in/eclipsepaulbecker
Reply
11-17-2017, 06:48 PM,
#2
RE: Edit a Language File Module - Blank Strings
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
Reply
11-17-2017, 09:45 PM,
#3
RE: Edit a Language File Module - Blank Strings
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.
https://www.linkedin.com/in/eclipsepaulbecker
Reply
11-18-2017, 03:40 AM,
#4
RE: Edit a Language File Module - Blank Strings
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
Reply
12-03-2017, 01:52 AM, (This post was last modified: 12-03-2017, 05:23 AM by VortecCPI.)
#5
RE: Edit a Language File Module - Blank Strings
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:

       

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.


Attached Files
.zip   messages.zip (Size: 240.52 KB / Downloads: 0)
https://www.linkedin.com/in/eclipsepaulbecker
Reply
12-03-2017, 05:57 AM, (This post was last modified: 12-03-2017, 08:04 AM by VortecCPI.)
#6
RE: Edit a Language File Module - Blank Strings
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:
   

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.


Attached Files
.zip   messages.zip (Size: 236.94 KB / Downloads: 2)
https://www.linkedin.com/in/eclipsepaulbecker
Reply
12-03-2017, 06:08 AM,
#7
RE: Edit a Language File Module - Blank Strings
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
Reply
12-03-2017, 07:12 AM,
#8
RE: Edit a Language File Module - Blank Strings
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;
https://www.linkedin.com/in/eclipsepaulbecker
Reply
12-04-2017, 06:57 AM, (This post was last modified: 12-04-2017, 06:59 AM by phil.)
#9
RE: Edit a Language File Module - Blank Strings
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.
Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Reply
12-04-2017, 09:06 AM,
#10
RE: Edit a Language File Module - Blank Strings
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)