Page MenuHomeFreeBSD

For discussion: website translation tools
Needs ReviewPublic

Authored by vladlen on Sep 27 2025, 2:38 PM.
Tags
Referenced Files
Unknown Object (File)
Sat, Oct 25, 11:23 AM
Unknown Object (File)
Sun, Oct 19, 11:54 AM
Unknown Object (File)
Sun, Oct 19, 11:54 AM
Unknown Object (File)
Sat, Oct 18, 9:56 PM
Unknown Object (File)
Sat, Oct 18, 1:10 AM
Unknown Object (File)
Wed, Oct 8, 8:49 PM
Unknown Object (File)
Mon, Oct 6, 2:39 AM
Unknown Object (File)
Thu, Oct 2, 1:34 PM
Subscribers
None

Details

Reviewers
maxim
Group Reviewers
doceng
Summary

Discussed in freebsd-translators list:
https://lists.freebsd.org/archives/freebsd-translators/2025-September/000229.html

This patch is not for commit, but for demonstration. Some details need to be improved before final decision and commit.

Project goal:
Include website translation to Weblate workflow with minimum of resources and process differences comparing to documentation workflow.
Idea:
Use the same or similar tools, but join all PO files per directory to one PO file.

Workflow for website:

tools/update_translate_template_website.sh

Similar to tools/update_translate_template.sh, but
a) ignore status and releases directories
b) creates one _indexdir.po file per directory (total 23 files)

  1. import data to weblate, export translated data from weblate to website/content/${lang} directories

to immitate this step I wrore script tools/immitate_translation.sh, that add some text in the beginning of every string to check the next step.
It has 2 parameters - language (defailt is ru) and text string - default is language plus '>' char. Run it:

tools/immitate_translation.sh ru

this utulity and immitate_translation.pl is not for commit to production, only for this demo.

  1. Translation to language:
tools/translate_website.sh ru

similar to

tools/translate.sh website ru

, but it takes translation from _indexdir.po and creates all adoc files, that exist in corresponding EN directory.
If you use it with immitate_translation.sh script, you get all "translated" files with English text prepended by text added in step 2.

Current issue:
1st step creates 1 PO file per directory, and the current implementation of the tool skips header of 1st adoc file, but it includes the headers of 2nd and the rest files to the PO file. It is not a problem, but it creates additional lines, that really do not need a translation. Probably this tool has some option in adoc2po adapter to prevent this behaviour, otherwise I could write script to filter these lines from final PO file.

Also I added script to convert TOML file to PO using TOML2YAML convertor yq (installed from package). It is for demonstration only, I did not checked it in workflow. TOML files looks like static files and they are updated in sequential order, not randomly. I am not sure, that usage of Weblate will significantly improve their translation.

Diff Detail

Repository
R9 FreeBSD doc repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

vladlen created this revision.
vladlen edited the summary of this revision. (Show Details)

Regarding "current issue" - I reported it to po2a repo : https://github.com/mquinson/po4a/issues/614
I hop[either will be fixed in upstream.