po files parsing

Discuss and coordinate development of mainline and user-made content translations.

Moderator: Forum Moderators

Post Reply
User avatar
hermestrismi
Posts: 730
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

po files parsing

Post by hermestrismi »

A translation question.
I want to begin to work for translating Wesnoth-manual and -manpages and there is a lot of confusing codes (almost every sentences is a test for me) . So, there a way to parse a .po file directly into the game to know if there is a translation incompatibility?
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2475
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: po files parsing

Post by Lord-Knightmare »

hermestrismi wrote: October 31st, 2024, 1:24 pm A translation question.
I want to begin to work for translating Wesnoth-manual and -manpages and there is a lot of confusing codes (almost every sentences is a test for me) . So, there a way to parse a .po file directly into the game to know if there is a translation incompatibility?
I dont know...but I think you can...use that software..."PoEdit"? To inspect this. I know it's a freemium, but I think you can compile a 100% free version from the poedit Github. I have not tried it, but the egallager person might know how.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
octalot
General Code Maintainer
Posts: 818
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: po files parsing

Post by octalot »

With -manpages and -manual, those textdomains aren't shown within the game inself. The files in -manpages are shown by the Unix man command, while -manual generates HTML to show in a web browser.
User avatar
hermestrismi
Posts: 730
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: po files parsing

Post by hermestrismi »

Lord-Knightmare wrote: October 31st, 2024, 2:03 pm I dont know...but I think you can...use that software..."PoEdit"? To inspect this. I know it's a freemium, but I think you can compile a 100% free version from the poedit Github. I have not tried it, but the egallager person might know how.
I use PoEdit among other utils altogether already but I didn't know there is a free version (it will help me if there is one) but it isn't sufficient. While PoEdit tell you if the sentence is 'equal' to the source, it doesn't tell if [ something ] or B-< something > is a code or a plain text. I m seeking for something to test directly the sentence looks after it is read by the game

octalot wrote: October 31st, 2024, 3:14 pm With -manpages and -manual, those textdomains aren't shown within the game inself. The files in -manpages are shown by the Unix man command, while -manual generates HTML to show in a web browser.
Good to know. Is this mean I can create a html example and past the translated sentences to it?
User avatar
octalot
General Code Maintainer
Posts: 818
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: po files parsing

Post by octalot »

Assuming Debian or Ubuntu, this should generate the manual's HTML file to open in a browser:

Code: Select all

/usr/bin/po4a-translate -f docbook -L utf8 -m doc/manual/manual.en.xml -p po/wesnoth-manual/ar.po -l doc/manual/manual.ar.xml --keep 0
/usr/bin/xsltproc --nonet --stringparam callout.graphics 0 --stringparam navig.graphics 0 --stringparam admon.textlabel 1 --stringparam admon.graphics 0 --stringparam html.stylesheet ./styles/manual.css /etc/asciidoc/docbook-xsl/xhtml.xsl doc/manual/manual.ar.xml > doc/manual/manual.ar.html
If you have a full build environment, scons update-po4a should run that, although it will run it without the --keep 0, which means that it will only generate the HTML file for languages that are a certain amount translated, by default 80%.
User avatar
hermestrismi
Posts: 730
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: po files parsing

Post by hermestrismi »

octalot wrote: October 31st, 2024, 6:31 pm Assuming Debian or Ubuntu, this should generate the manual's HTML file to open in a browser:

Code: Select all

/usr/bin/po4a-translate -f docbook -L utf8 -m doc/manual/manual.en.xml -p po/wesnoth-manual/ar.po -l doc/manual/manual.ar.xml --keep 0
/usr/bin/xsltproc --nonet --stringparam callout.graphics 0 --stringparam navig.graphics 0 --stringparam admon.textlabel 1 --stringparam admon.graphics 0 --stringparam html.stylesheet ./styles/manual.css /etc/asciidoc/docbook-xsl/xhtml.xsl doc/manual/manual.ar.xml > doc/manual/manual.ar.html
If you have a full build environment, scons update-po4a should run that, although it will run it without the --keep 0, which means that it will only generate the HTML file for languages that are a certain amount translated, by default 80%.
I published wesnoth-manual (70%) but I didn't find it in the Wiki of wesnoth. Is there something wrong?
User avatar
octalot
General Code Maintainer
Posts: 818
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: po files parsing

Post by octalot »

The default for po4a is to only generate documents once they're 80% translated, so it doesn't generate it yet, sorry.

I suspect that getting it listed on the Wiki will need Ivanovic or Pentarctagon to edit the Wiki page.
User avatar
hermestrismi
Posts: 730
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: po files parsing

Post by hermestrismi »

octalot wrote: November 16th, 2024, 2:29 pm The default for po4a is to only generate documents once they're 80% translated, so it doesn't generate it yet, sorry.

I suspect that getting it listed on the Wiki will need Ivanovic or Pentarctagon to edit the Wiki page.
Thank you for the explanation. I will once I finish it. Right now, I want to congratulate myself for my ego needs some cheers :eng:
Post Reply