Weblate Translation Tips
Contents
This is a step-by-step to build each document after translating them with Weblate.
All examples are for pt-br language, replace it with your language code.
Repositories
Clone all repositories, FreeBSD doc, and Weblate translations.
$ cd /tmp $ git clone https://git.freebsd.org/doc.git $ git clone https://github.com/freebsd/freebsd-doc-translate.git $ cd doc
Articles
General Notes
After translating with tools/translate.sh, consider that executing the script will overwrite those manual changes in articles other than the one you are working on. Pay attention before submitting. Especially, try to avoid git -a and git restore as many *.adoc files as necessary.
When creating new articles to the tree, shared/$LANGUAGE/urls.adoc needs to be adjusted. For instance, once the Spanish bsdl-gpl article is added to the tree make the following change in shared/es/urls.adoc:
bsdl-gpl: https://docs.freebsd.org/articles/bsdl-gpl/ --> bsdl-gpl: {main-site}/articles/bsdl-gpl/
leap-seconds
Copy translation (single .po) to the doc tree.
$ cp ../freebsd-doc-translate/documentation/content/pt_BR/articles/leap-seconds/_index.po \ documentation/content/pt-br/articles/leap-seconds/_index.po
Convert the .po file to .adoc.
$ ./tools/translate.sh documentation pt-br
Build.
$ DOC_LANG="en pt-br" make documentation
Check.
$ open documentation/public/pt-br/articles/leap-seconds/index.html
Submit.
contributors
Just necessary to translate index and contrib-develinmemoriam.
Copy translation (both .po) to the doc tree.
$ cp -a ../freebsd-doc-translate/documentation/content/pt_BR/articles/contributors/_index.po \ documentation/content/pt-br/articles/contributors/ $ cp -a ../freebsd-doc-translate/documentation/content/pt_BR/articles/contributors/contrib-develinmemoriam.po \ documentation/content/pt-br/articles/contributors/
Convert the .po file to .adoc.
$ ./tools/translate.sh documentation pt-br
Other includes will reference the English document files; the exception is contrib-develinmemoriam.
include::content/en/articles/contributors/contrib-committers.adoc[] include::content/en/articles/contributors/contrib-corealumni.adoc[] include::content/en/articles/contributors/contrib-develalumni.adoc[] include::content/en/articles/contributors/contrib-portmgralumni.adoc[] include::{include-path}contrib-develinmemoriam.adoc[] include::content/en/articles/contributors/contrib-additional.adoc[] include::content/en/articles/contributors/contrib-386bsd.adoc[]
Build.
$ DOC_LANG="en pt-br" make documentation
Check.
$ open documentation/public/pt-br/articles/contributors/index.html
Submit.
explaining-bsd
Copy translation (single .po) to the doc tree.
$ cp ../freebsd-doc-translate/documentation/content/pt_BR/articles/explaining-bsd/_index.po \ documentation/content/pt-br/articles/explaining-bsd/_index.po
Convert the .po file to .adoc.
$ ./tools/translate.sh documentation pt-br
Build.
$ DOC_LANG="en pt-br" make documentation
Check.
$ open documentation/public/pt-br/articles/explaining-bsd/index.html
Submit.
Books
fdp-primer
Create fdp-primer directory.
$ cd doc $ mkdir -p documentation/content/pt-br/books/fdp-primer/
Copy translations (multiple .po) to the doc tree.
$ cp -a -R \ ../freebsd-doc-translate/documentation/content/pt_BR/books/fdp-primer/* \ documentation/content/pt-br/books/fdp-primer/
Add fdp-primer to documentation/content/pt-br/books/books.adoc.
Copy content/en/books/fdp-primer/chapters-order.adoc to content/pt-br/books/fdp-primer/chapters-order.adoc
$ cp documentation/content/en/books/fdp-primer/chapters-order.adoc \ documentation/content/pt-br/books/fdp-primer/chapters-order.adoc
Convert .po files to .adoc.
$ ./tools/translate.sh documentation pt-br
Check translations and brake lines. Some tables and examples can break the build.
A few examples that needed attention when translating to pt-br:
- documentation/content/pt-br/books/fdp-primer/doc-build/_index.adoc https://cgit.freebsd.org/doc/tree/documentation/content/en/books/fdp-primer/doc-build/_index.adoc#n245 https://cgit.freebsd.org/doc/tree/documentation/content/en/books/fdp-primer/doc-build/_index.adoc#n314 - documentation/content/pt-br/books/fdp-primer/manual-pages/_index.adoc https://cgit.freebsd.org/doc/tree/documentation/content/en/books/fdp-primer/manual-pages/_index.adoc#n187 - documentation/content/pt-br/books/fdp-primer/writing-style/_index.adoc https://cgit.freebsd.org/doc/tree/documentation/content/en/books/fdp-primer/writing-style/_index.adoc#n191 - documentation/content/pt-br/books/fdp-primer/examples/_index.adoc Copy examples from the English. - documentation/content/pt-br/books/fdp-primer/structure/_index.adoc - documentation/content/pt-br/books/fdp-primer/rosetta/_index.adoc - documentation/content/pt-br/books/fdp-primer/examples/_index.adoc
Add attribute translations manually.
documentation/content/pt-br/books/fdp-primer/asciidoctor-primer/_index.adoc documentation/content/pt-br/books/fdp-primer/doc-build/_index.adoc documentation/content/pt-br/books/fdp-primer/editor-config/_index.adoc documentation/content/pt-br/books/fdp-primer/manual-pages/_index.adoc documentation/content/pt-br/books/fdp-primer/see-also/_index.adoc documentation/content/pt-br/books/fdp-primer/structure/_index.adoc documentation/content/pt-br/books/fdp-primer/translations/_index.adoc documentation/content/pt-br/books/fdp-primer/writing-style/_index.adoc :toc-title: Índice documentation/content/pt-br/books/fdp-primer/examples/_index.adoc :toc-title: Índice :example-caption: Exemplo documentation/content/pt-br/books/fdp-primer/po-translations/_index.adoc :toc-title: Índice :table-caption: Tabela :example-caption: Exemplo documentation/content/pt-br/books/fdp-primer/rosetta/_index.adoc :toc-title: Índice :table-caption: Tabela
Check line number from all includes documentation/content/pt-br/books/fdp-primer/book.adoc. Example e528e6bcbd.
Build.
$ DOC_LANG="en pt-br" make documentation
Check.
$ open documentation/public/pt-br/books/fdp-primer/index.html
Submit.