26 Updating Translations
David Marzal edited this page 2020-12-27 11:41:20 +01:00
This wiki contains the developer documentation for AntennaPod. If you are a user and you are looking for help, have a look at our [website](https://antennapod.org/faq)!
This wiki contains the developer documentation for AntennaPod. If you are a user and you are looking for help, have a look at our website!

Transifex is used to do translation work for AntennaPod (project page).

On this page:

Editing translations

Online: Just login to Transifex and register as a translator for the project.

Offline editing

The basic steps are outlined below. Check the Transifex guide for more extensive info.

Install the Transifex Client

pip install transifex-client

Create .transifexrc

Perhaps the best way to do this is to run tx init in a new directory (unrelated to AntennaPod or it will mess up the .tx/config file). It will prompt you for your Transifex username and password.

Updating Translations

When we update translations we must be careful to follow a specific workflow or else translations could be lost. Avoid using tx push -t as that can overwrite the work of the translators.

From the AntennaPod root folder with git in a branch specific to these new translations state:

# get the new translations
tx pull -a
[At this point, you, the maintainer, might have to add new languages to the Transifex config. This is pretty straightforward - We believe in you!]
# commit the new translations
git commit ...
# push the new translations up to GitHub
git push origin <the branch name>
# Submit a PR for these translations on GitHub

## NOW send any updates to the source files
tx push -s

Questions & Answers

Q: Is it also possible to request strings from Transifex while you are on the branch? This would enable to collect all needed data first before it is merged into master?
A: Transifex is no automatic translation service (at least we are not using it that way). We upload the new strings (in english, only) and volunteers translate the strings manually via their web interface. Later, we pull the translations. (I could have added translations for German, but we would then have to merge my "local" changes with changes already made on Transifex - translations of so far untranslated strings or changes to the translation -, I don't see any use in making it any more complicated than it already is)

Transifex can make suggestions for a translations, but they are not reliable enough.

Does this also work while you are on the branch?
Why shouldn't it?
In the repo, we are the only ones writing to the english strings, all the other languages are only ever updated by pulling translations from transifex. No conflicts.

Reference: #1369 Rating Dialog

Q: I'm sure I have translated a certain, rather long, string before. This translation never made it into the app: the source string was updated before translations were pulled to git. As the source string was replaced, my translation has been removed from Transifex. Would it be possible to recover this string somehow?
A: All data ever entered for a project gets stored in the 'Translation Memory' of Transifex. Though this database doesn't seem to be accessible to the developers, rest assured that your previous translation work will show up under the 'suggestions' if the old and the new string are somewhat similar. It just takes a while for Transifex process and match old and new source and translation strings, so come back to Transifex in a few days!

Reference: #1257 Old translated strings still available?

Q: How to update the English (source) strings?
A: Source strings (English) are stored in AntennaPod/core/src/main/res/values/strings.xml ; you do a Pull Request to update that file. When making changes to the source language, please use American spelling.

Q: Why don't you run automatic checks to approve that strings in all languages are present, before merging pull requests into the master branch?
A: This is simply a matter of convention; we didn't do it in the past and introducing such checks might lead to some difficulties. What to do with the information that a language is incomplete, for example? Do we halt roll-out of an update, or do we put effort in chasing volunteers? Or do we ignore the warning and just let it be? On the other hand, if we don't set up such checks, Android will simply use the English strings if a language lacks a translation. If there are not volunteers to translate a language or new strings, we just have to live with that. Noting of course that some kind of check is done by the developers themselves (if there's really few translations, we won't provide the few strings to the end-user). And users bumping into untranslated strings might be motivated to help out ;)

Reference: #1369 Rating Dialog

Translation files and process

Source strings are uploaded to Transifex one to two weeks prior to release. The following files are related to translation of AntennaPod:

  • AntennaPod/.tx/config → The transifex project configuration. Indicates which translation files (eg trans.fr or trans.sv_SE) need to be placed in which folder in the codebase
  • AntennaPod/core/src/main/res/ → The folder in the codebase where all translation files are stored. Each language has its own folder, eg values-fr or values-sv-rSE, with in that folder a strings.xml file.

(AntennaPod/core/src/main/java/de/danoeh/antennapod/core/util/LangUtils.java seems to just tell the user what language a certain podcast is in. Doesn't have anything to do with translations.)

Adding a new language

  1. Start off with translating AntennaPod on Transifex. You can ask on the Google group for help with translations work.
  2. Register for the [Beta programme](Help test AntennaPod) to be able to check your translations in context before it gets released to the general public.
  3. Wait for the main developers to change the Transifex configuration file and merge the latest strings from Transifex (often done a few days before release)

* Regarding the configuration file change, we need to be kind of careful with what we pull from Transifex: If the language file isn't correct, the build will break.