Translation of app string resources

Current localization documentation is available here

Translations of string resources are done at translatewiki.net (aka TWN).

Repo Configuration
See Wikipedia iOS and Wikipedia Android groups in translatewiki.net Gerrit project.

Requesting Access
All of the following steps must be performed on translatewiki.net, and therefore require that you have access to the machines. To request access:
 * 1) File a Phabricator ticket to request access and add it to the translatewiki.net project (see example)
 * 2) Be sure to include the public key of the RSA key you want to use to access the machine
 * 3) Ensure your local SSH config uses the correct identity file for the translatewiki.net host
 * 4) The i18n team will then review your request for access, and if granted, update the translatewiki.net manifest to add your key
 * 5) File another Phabricator ticket to request access to review changes (see example)
 * 6) Create a user on translatewiki.net
 * 7) Mention user name in Phab ticket

SSH Config
In step 2 above, your SSH config should look something like this: Host translatewiki.net User bgerstle IdentityFile ~/.ssh/translate_wiki_rsa

TWN sync for Android
About once a week we sync string resources between our code and TWN. The terms import and export are used based on the TWN perspective. We first import new strings (English + qqq) from our code bases to TWN then export translated strings out of TWN to our code bases. The following section document how this is done at a low level.

Before starting the TWN sync make sure you have joined the  IRC channel.

Import from Android code to TWN
If the last command say "No changes" then continue with the export steps.

If it says something like "Process changes at https://translatewiki.net/wiki/Special:ManageMessageGroups" then go to that URL in your browser, review the to be imported strings. See also #Notes about flags.

Run job queue if there were changes to expedite the process (otherwise you have to wait a few minutes to make sure the import, which runs in the background, is complete:

Export from TWN to Android code
This will push a new commit to Gerrit in the respective app repo(s): Go to Gerrit and run the translation tests, then merge.

Import from iOS code to TWN
If the last command say "No changes" the continue with the export steps.

If it says something like "Process changes at https://translatewiki.net/wiki/Special:ManageMessageGroups" then go to that URL in your browser, review the to be imported strings.

Run job queue if there were changes to expedite the process (otherwise you have to wait a few minutes to make sure the import, which runs in the background, is complete:

Export from TWN to iOS code
The steps are as follows:

Pushing TWN changes to GitHub
If your GitHub account uses two-factor authentication (2FA) you'll need to create a personal access token, which will be used as your GitHub password in the  phase. If it doesn't use 2FA, it should!

Integrating new localizations
Sometimes new languages will be added for an existing localized resource. Manually verify that all localized assets are integrated into the Xcode project by checking for added files and ensuring their corresponding language is checked in the Xcode file inspector panel. TODO: automatically integrate "lproj" assets into Xcode project via xcodeproj Ruby gem.

Notes about flags
Note about the   flag: We tend to ignore translated string resource changes, unless there is a good reason for them to be done in our code and it should be reflected in TWN. (Usually translated strings come from TWN, and not the other way around.)

Note about the   flag: If the meaning of the English string has changed then mark it as fuzzy so it shows up as  in the TWN interface. Then translators know they should translate the string again.

One time TWN sync setup
Set GERRIT_USER to the proper value. This is currently written for both Android and iOS but will need to be split up in the future. Follow steps in Gerrit settings to set up a new set of ssh keys so you don't need to do ssh agent forwarding.

Fixing translations on TWN site
To get to the string in TWN fast you can:
 * 1) go to the Message group statistics for Android or iOS,
 * 2) click on the language you want,
 * 3) switch from   to   or  ,
 * 4) then enter the translated string in the.
 * 5) From there (in the "List" tab) you can click on.

Change translations
You can change the string here but that should be left to the translators. What you can do though is to add the string  in front of the current text to mark it fuzzy/outdated. You can also look at the translation history of that particular string by clicking on the little down arrow.

Spanish
https://translatewiki.net/w/i.php?title=Special:Translate&action=translate&group=out-wikimedia-mobile-wikipedia-android-strings&language=es&filter=

History: https://translatewiki.net/w/i.php?title=Wikimedia:Wikipedia-android-strings-app_name_prod/es&action=history

Talk: https://translatewiki.net/wiki/Wikimedia_talk:Wikipedia-android-strings-app_name_prod/es

Simplified Chinese: For zh/strings.xml use zh-hans
https://translatewiki.net/w/i.php?title=Special:Translate&action=translate&group=out-wikimedia-mobile-wikipedia-android-strings&language=zh-hans&filter=

Traditional Chinese: For zh-rTW/strings.xml use zh-hant
https://translatewiki.net/w/i.php?title=Special:Translate&action=translate&group=out-wikimedia-mobile-wikipedia-android-strings&language=zh-hant&filter=

More about Message group statistics
A given language is only exported from TWN if it has reached or exceeded a certain translation completeness threshold. Currently the threshold is set to 35%.

Translatewiki.net on Gerrit
https://gerrit.wikimedia.org/r/#/admin/projects/translatewiki

For Android TWN sync see, esp. the   section.