Translate wiki pages

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
Post Reply
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Translate wiki pages

Post by hermestrismi »

I'm asking if it is technically possible to make the wiki (or parts of it) into .po files related to the the Wesnoth-manual or in a separate section.
(I don't know if I described the feature correctly).
the purpose is to make the wiki easily accessible to Translation instead of adding pages each time a translator wants to translate a page.
User avatar
Celtic_Minstrel
Developer
Posts: 2222
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Translate wiki pages

Post by Celtic_Minstrel »

I don't think it makes sense to use po files to translate entire pages like on the wiki. I'm not sure if there are other steps that could be taken to make wiki translation more accessible though.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Translate wiki pages

Post by octalot »

I'd skipped over this topic because I doubt we can add modifications to the Wiki (or more accurately, AFAIK it's not something that people want to maintain), so uploading .po files directly to the Wiki doesn't seem likely. However, the po4a tools that are used for the Wesnoth manpages and manual should be able to work if you want to manually:
  • Download the source of a page
  • Run po4a locally
  • Upload the result
That should handle splitting paragraphs into separate items in the .po file, and tracking which paragraphs have been modified.
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: Translate wiki pages

Post by hermestrismi »

octalot wrote: April 2nd, 2024, 3:36 pm I'd skipped over this topic because I doubt we can add modifications to the Wiki (or more accurately, AFAIK it's not something that people want to maintain), so uploading .po files directly to the Wiki doesn't seem likely. However, the po4a tools that are used for the Wesnoth manpages and manual should be able to work if you want to manually:
  • Download the source of a page
  • Run po4a locally
  • Upload the result
That should handle splitting paragraphs into separate items in the .po file, and tracking which paragraphs have been modified.
Unfortunately, I am not familiar with po4a. can I do the same with poedit (I doubt that but perhaps) or I should get familiar with po4a?
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Translate wiki pages

Post by octalot »

po4a is a different part of the toolchain - it updates .po files from original documents, and creates translated documents from the original plus the .po files. The actual translation still happens in whichever .po editor you prefer.

Diagram from https://po4a.org/man/man1/po4a.1.php

Code: Select all

master documents ---+---->-------->---------+
  (doc authoring)    |                       |
                     V   (po4a executions)   >-----+--> translated
                     |                       |           documents
 existing PO files -->--> updated PO files >-+
      ^                            |
      |                            V
      +----------<---------<-------+
       (manual translation process)
The wesnoth-manual and wesnoth-manpages .po files are generated by, and processed by, po4a. However, Wesnoth's setup isn't a good reference for how to use it, because we have scripts originally written circa 2007, and maintained to keep working rather than changing to po4a's current recommended workflow.

If someone's setting up po4a then it probably makes sense for it to be centralised so other languages' translators can use it too, but I don't want to commit to organising that myself. For bilingual people already familiar with .po files, po4a is a useful utility for writing and proofreading documents that need to be in two languages, but the quick-start guide isn't written with that target audience in mind.

From GettingStarted, I clicked on the "view source" link and copied it into the clipboard
  • pasted it into a text file called GettingStarted.wiki
  • created a subdirectory called po, the name's chosen in the config file that you write
  • made an empty file po/wiki.pot, because po4a will automatically find and use a .pot file in the configured directory, but needs you to create one instead of making one itself
  • created the config below, calling the file po4a.cfg
  • ran po4a po4a.cfg the first time
Config file, which I've called po4a.cfg

Code: Select all

[po_directory] po
[type: text] GettingStarted.wiki $lang:translated/GettingStarted.wiki.$lang
[options] --master-charset UTF-8 --localized-charset UTF-8
[options] --verbose --keep 0
Then open the .pot file in Poedit, click on the "Create new translation" button, and save your .po file in the po directory. Run po4a po4a.cfg again and it should start creating the file in the translated directory for you. Note that it needs the --keep 0 option in the config file, otherwise it'll only create documents that are at least 80% translated.

Permission is granted to use anything in this post for a contribution to po4a's docs.
Attachments
wiki.pot
Handling it as plain text (it doesn't understand Wiki markup), which means headings get treated as part of the following paragraph.
(26.96 KiB) Downloaded 10 times
User avatar
Celtic_Minstrel
Developer
Posts: 2222
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Translate wiki pages

Post by Celtic_Minstrel »

I think translating wiki stuff is probably better done using wiki-specific methods rather than something like po4a, especially since po4a doesn't support MediaWiki markup. For example, this extension (which is not installed on our wiki though).

From my perspective, the flow you've outlined seems quite arcane. You need to extract the wiki text, run po4a, translate it, run po4a again, and then paste the wiki text into the translated version of the page. Each of those steps seems like a pain, and automating the whole process seems like it would be a pain too. It can certainly be done (MediaWiki has an API, I think) but I'm sure there are better ways to do this.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply