Translating content¶
TODO: intro copy
Getting started with translating¶
To get started, you need let us know you're interested in translating so we can add you to the Weblate translation team. The first step is ensure you have an account on Weblate. Create a new account if you don't currently have one.
There are two options for letting us know that you'd like to help out with translations:
- If you're on Discord, join the BeeWare server, and head to the #translations channel.
- If you're not on Discord, you can create a new issue on the BeeWare Docs Tools repository.
In both cases, leave a message including the following information:
- Your Weblate username
- The language you are planning to which you are planning to translate content
Once we have this info, we'll get you added to the team.
New translations¶
If the language you plan to help out with doesn't already exist, there is some setup necessary on our end before you can get started.
To set up a new language, the following steps must be completed:
- Create the
/docs/mkdocs.language-code.ymlfile, with language-specific content. - Update
tox.inito include the new language build commands. - Update
/docs/config.ymlto include the language underextra: alternate:.
The following demonstrates the necessary changes using German as an example.
The new MkDocs configuration file¶
The first thing to do would be to create a new file named mkdocs.de.yml in the
docs directory, with the following content:
INHERIT: config.yml
site_name: BeeWare Demo zu Docs Tools
site_url: https://beeware-docs-tools.beeware.org/de
docs_dir: de
theme:
language: de
extra:
translation_type: machine
Here's what is going on in this file:
- This file inherits the configuration content from
config.yml. - The
site_namevalue is translated. - The
site_urlvalue is the project site URL, followed by the language code. - The
docs_dirshould be the language code. - The
theme: language:value should be the language code, as specified by the MkDocs Material theme. The list can be found here. For most languages, this will be the same as thedocs_dirlanguage code; but for some (in particular languages with locale variants likezh_CN), there are differences. - The
extra: translation_type:should bemachineuntil the translation reaches 100% for the first time, at which point it should behuman. It will revert tomachinefromhumanif it regresses to below 90%.
The update to tox.ini¶
You'll need to make several changes to the tox.ini file.
You would add the following:
- The new language code environment flag to the header line which begins
[testenv:docs, with the language code preceded by a-, with no spaces included, e.g.-de. - The new language code exclusion to the first command, which begins with
!lint, preceded by-!, with no spaces included, e.g.-!de. - The new language code to the end of the line beginning with
translate : build_po_translations. - The new language code to the end of the line beginning with
translate : update_machine_translations - A new command, beginning with, for example,
de : build_md_translationsfor German, after the other existing language-specific commands that matches the content those commands with the new language code. - The new language code to the end of the line beginning with
all,serve :.
The update to config.yml¶
You need to add the language to config.yml for it to show up in the language
selector in the header. Find the section beginning with extra:, and then
locate the subsection beginning with alternate:. For German, you would add the
following:
- name: Deutsch
link: /de/
lang: de
The language name should be translated into the language. The link must include
the /s.
The new language is now ready to begin translation.
Translation guidelines¶
Once you've been added to the team, it's time to log into Weblate and begin working through translating strings.
Tone versus word-for-word translation¶
It's more important to maintain the tone of the English text than to strive for a word-for-word translation. We try to be friendly and a bit colloquial in our content; try to maintain the spirit of that in your translations.
If the English text contains a strong English idiom, don't feel beholden to maintain the idiom, if there is an analog in your language that would work equally well. If the term or phrase in the English text is a particularly idiomatic or slang term, don't be afraid to tell us we should consider making a change. Even for English speakers, idioms and slang can pose difficulty. Sometimes we need to change the English text to make it more straightforward for translators and readers alike.
Should I translate it?¶
Les éléments suivants ne doivent pas être traduits ou mis à jour :
- Les commandes. Par exemple, dans "You should run `briefcase create`.", seul "You should run" doit être traduit.
- Namespaces; class, method, or attribute names.
- Link URLs. Standard Markdown links should appear in Weblate as
[Link text]{1}, where1is the position of the link in the string with reference to other possible links. If the full URL is included in the string, as[Link text](https://example.com), the URL should be skipped for translation. -
Reference links containing class, method or attribute names. These should be left as-is, including the backticks. Every part of the example link shown here would not be translated.
[`Class.attribute`][Class.attribute] -
Reference link link-content. For example,
link-contentwould be skipped in the following:[Link text][link-content]. - Jinja directives. This is any content wrapped inside two pairs of matching curly braces, or a matching pair of single curly braces with percent signs inside each end. Note: Including an example of the syntax here causes the Macros plugin to attempt to render it; see the Macros documentation for examples.
- Custom anchors. They are found after headers or above some content, and are
formatted as
{ #anchor }. -
Admonition syntax. As shown here, the word "admonition" should not be translated. This goes for all styles of admonitions, including notes, warnings, etc. See the next section for information on translating the rest of the content.
/// admonition | Title Content. /// -
Backticks. They are meant to stay as backticks; they are used for formatting both inline code and code blocks.
- La syntaxe pour inclure du contenu externe. Il s'agit de tout ce qui se trouve
sur la même ligne que
-8<-, ou sur les lignes entre deux-8<-sur des lignes séparées.
Les éléments suivants devraient être traduits :
- Link text. In link syntax, the text comes before the URL, and is enclosed in
brackets, as in
[Link text](URL). Standard Markdown links should appear in Weblate as[Link text]{1}, where1is the position of the link in the string with reference to other possible links. - Reference link text. For example,
Link textwould be translated in the following:[Link text][link-content]. -
Les titres et le contenu de l'avertissement. Comme indiqué ci-dessous, les mots "Titre" et "Contenu" doivent être traduits. Voir ci-dessus pour des informations sur la syntaxe.
/// admonition | Title Content. ///
Weblate¶
Weblate processes everything on a string-by-string basis. It batches changes, and every couple of hours, it will submit a bulk commit with all the strings that have changed in that interval. So, it may take a couple of hours for your changes to show up on the website, but you can expect the update to appear within four hours.
If after that time, your changes still haven't appeared, the likely cause is a markup error, resulting in a failure in the docs build for that language. Any markup problem in any string will block the entire translation from being public. You can keep an eye on the build page for your language to see whether it has successfully built. The link is formatted similarly to this link to the French build page https://app.readthedocs.org/projects/beeware-docs-tools-fr/; change the language code to your language to view the appropriate build page. This will show the state of the most recent build of the site. If the build fails, look at the build log, and see if you can identify the source of the problem.