Converting to PO format

Having a question about translating phpBB 3.2? Want to discuss and collaborate with people currently translating phpBB 3.2? Here would be the correct place to do so.
User avatar
scootergrisen
Translator
Posts: 222
Joined: Thu Aug 25, 2011 2:25 pm

Converting to PO format

Post by scootergrisen »

Are there any code to convert the translation PHP files to PO files?
So that i can use various software to check the translations like they can check for missing "." at the end and correct case at the beginning of each string, etc.
mdkdio
Registered User
Posts: 37
Joined: Sun Jan 21, 2018 6:25 pm

Re: Converting to PO format

Post by mdkdio »

Hi scootergrisen!

Are you using GNU gettext by any chance?
If so, check out their manual for some help
User avatar
scootergrisen
Translator
Posts: 222
Joined: Thu Aug 25, 2011 2:25 pm

Re: Converting to PO format

Post by scootergrisen »

I do have the gettext tools but i dont see how the link to PHP Format Strings could help me.
I have made some code to take extract the british english strings and the danish strings and then combine them to make a PO file but its but pretty and parts i have to do manually.

But i do manage the generate a PO file that i could open other translation programs (like Virtaal) and found errors to correct in the translation with the quality control.

What code generates the british english php files?
Or are they changed manually?
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Converting to PO format

Post by david63 »

scootergrisen wrote: Sat Mar 31, 2018 4:44 pm Or are they changed manually?
There is no other way
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
scootergrisen
Translator
Posts: 222
Joined: Thu Aug 25, 2011 2:25 pm

Re: Converting to PO format

Post by scootergrisen »

If some want to see their translation in PO format you can say it and i can make it for you.
I have managed to create some code to extracts the strings and create a PO file from it but i have to do some parts manually so the code is not so good yet.
You can use the PO file it to find all kinds of errors like missing "." at the end of the string and so on with many tools.
User avatar
scootergrisen
Translator
Posts: 222
Joined: Thu Aug 25, 2011 2:25 pm

Re: Converting to PO format

Post by scootergrisen »

I managed to make all the po creation automatic so now i dont have to do some parts manually.
I have put the files on GitHub so other people can try it and help improve the code.
https://github.com/scootergrisen/phpbbpo

Tell me the problems you have with the files so we can improve it. :)
User avatar
Crizzo
Translations & International Support Teams Manager
Translations & International Support Teams Manager
Posts: 1669
Joined: Thu Apr 23, 2009 1:20 pm
Location: Stuttgart, Germany
Name: Christian
Contact:

Re: Converting to PO format

Post by Crizzo »

Hi,

I still don't get the advantage of this PO format.

How is that better than the simple php-files?
My extensions for phpBB: CDB
German phpBB Support at www.phpbb.de
User avatar
scootergrisen
Translator
Posts: 222
Joined: Thu Aug 25, 2011 2:25 pm

Re: Converting to PO format

Post by scootergrisen »

Suppose you translate a string in a phpBB language pack.
What will you do?
Go to https://www.phpbb.com/customise/db/tran ... h_english/ download the correct version, extract zip file, find the correct file, open two files in text editor, switch multiple times between tabs to see the source string and translate in the other tab.
I'm guessing this is the way phpBB translators do.

In a PO file you have the source string with the translation in the same file.

Its easier, made for translation.

Here is the German (Casual Honorifics) translation if you want to check it.
Board would not allow me to upload file ending with ".po" so i added ".txt" which you can remove after download.
german_casual_honorifics_3_2_2.po.txt
(981.02 KiB) Downloaded 68 times
You can open the po file in Virtaal.
See how many erros you can find with the quality check.
User avatar
Crizzo
Translations & International Support Teams Manager
Translations & International Support Teams Manager
Posts: 1669
Joined: Thu Apr 23, 2009 1:20 pm
Location: Stuttgart, Germany
Name: Christian
Contact:

Re: Converting to PO format

Post by Crizzo »

scootergrisen wrote: Tue Apr 10, 2018 9:43 pm See how many erros you can find with the quality check.
The programm told me: 0 errors found.

So I think the translation is not that bad. :mrgreen:

But on the first view, it looks quite okay. But I don't know, how you could find specific language-keys for bug fixing and little changes?
My extensions for phpBB: CDB
German phpBB Support at www.phpbb.de
User avatar
scootergrisen
Translator
Posts: 222
Joined: Thu Aug 25, 2011 2:25 pm

Re: Converting to PO format

Post by scootergrisen »

Like this:
germanpo.jpg
I added the keys from the PHP files as comments (and also msgctxt at the moment) which you can use to search in the php files.

Code: Select all

#. DEFAULT_DATE_FORMAT_EXPLAIN
msgctxt "DEFAULT_DATE_FORMAT_EXPLAIN"
msgid "The date format is the same as the PHP <code>date</code> function."
msgstr "Die Syntax entspricht der der <a href=\"http://www.php.net/date\"><code>date()</code></a>-Funktion von PHP."
You can see it says "der" two times in the translation.
So if that is a mistake you can search for "DEFAULT_DATE_FORMAT_EXPLAIN" in the german language pack php files and correct it.
User avatar
Crizzo
Translations & International Support Teams Manager
Translations & International Support Teams Manager
Posts: 1669
Joined: Thu Apr 23, 2009 1:20 pm
Location: Stuttgart, Germany
Name: Christian
Contact:

Re: Converting to PO format

Post by Crizzo »

scootergrisen wrote: Thu Apr 12, 2018 7:48 pmYou can see it says "der" two times in the translation.
So if that is a mistake you can search for "DEFAULT_DATE_FORMAT_EXPLAIN" in the german language pack php files and correct it.
But then I don't see, why I need the PO format here? Finding typos and similar looks not easier to me with the PO format, then using just the php-file or the translated board.
My extensions for phpBB: CDB
German phpBB Support at www.phpbb.de
User avatar
scootergrisen
Translator
Posts: 222
Joined: Thu Aug 25, 2011 2:25 pm

Re: Converting to PO format

Post by scootergrisen »

Here is command line tool that can find the same things and it can also show in colors on the command line which can help.
You could redirect the output to a file and read it.
poabc.jpg
But then I don't see, why I need the PO format here? Finding typos and similar looks not easier to me with the PO format, then using just the php-file or the translated board.
If its not easier then why have the "der der" typeo not been fixed?
How would you have found if i did not tell you about it?
User avatar
Crizzo
Translations & International Support Teams Manager
Translations & International Support Teams Manager
Posts: 1669
Joined: Thu Apr 23, 2009 1:20 pm
Location: Stuttgart, Germany
Name: Christian
Contact:

Re: Converting to PO format

Post by Crizzo »

Okay, I see what the tool does. The problem is, we have something like this e.g. in german quite often:
Den Hostname oder DSN des Datenbankservers — die Adresse, unter der der Datenbankserver erreichbar ist.
from INSTALL_INTRO_BODY.
scootergrisen wrote: Thu Apr 12, 2018 8:00 pm If its not easier then why have the "der der" typeo not been fixed?
How would you have found if i did not tell you about it?
It is no typo. :oops:
My extensions for phpBB: CDB
German phpBB Support at www.phpbb.de
User avatar
scootergrisen
Translator
Posts: 222
Joined: Thu Aug 25, 2011 2:25 pm

Re: Converting to PO format

Post by scootergrisen »

Ok its not everything the tools reports that are mistakes/typos.
It just help find some of them and then you can check everything and ignore some of the checks.
User avatar
Crizzo
Translations & International Support Teams Manager
Translations & International Support Teams Manager
Posts: 1669
Joined: Thu Apr 23, 2009 1:20 pm
Location: Stuttgart, Germany
Name: Christian
Contact:

Re: Converting to PO format

Post by Crizzo »

I think if this should be a real alternative to the existing way, there should be a tool which converts the php-files in two-ways.

For such quick edits for any admins of boards, there was a acp-editor, but it was removed due to too much problems at the end-user side.
My extensions for phpBB: CDB
German phpBB Support at www.phpbb.de
Post Reply

Return to “[3.2.x] Translations”