From 81094c6676e9d24fcf3b4c9569afeed817f5233f Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Wed, 9 Nov 2022 12:23:38 +0100 Subject: [PATCH] Add a little documentation on how to L10n (#539) --- Localization/README.md | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/Localization/README.md b/Localization/README.md index ac32319cc..9bdbae360 100644 --- a/Localization/README.md +++ b/Localization/README.md @@ -1,23 +1,34 @@ # Localization [![Crowdin](https://badges.crowdin.net/mastodon-for-ios/localized.svg)](https://crowdin.com/project/mastodon-for-ios) -Mastodon localization template file +We use Crowdin for translations and some automation. +## How to contribute -## How to contribute? +### Help with translations -Please use the [Crodwin](https://crowdin.com/project/mastodon-for-ios) to contribute. If your language is not in the list. Please feel free to open the issue. +Head over [Crowdin][crowdin-mastodon-ios] for that. To help with translations, select your language and translate :-) If your language is not in the list, please feel free to [open a topic on Crowdin](crowdin-mastodon-ios-discussions). -## How to maintains +Please note: You need to have an account on Crowdin to help with translations. -The project use a script to generate Xcode localized strings files. +### Add new strings -```zsh -// enter workdir -cd Mastodon +This is mainly for developers. -// merge PR from Crowdin bot +1. Add new strings in `Localization/app.json` **and** the `Localizable.strings` for English. +2. Run `swiftgen` to generate the `Strings.swift`-file **or** have Xcode build the app (`swiftgen` is a Build phase, too). +3. Use `import MastodonLocalization` and its (new) `L10n`-enum and its properties where ever you need them in the app. +4. Once the updated `Localization/app.json` hits `develop`, it gets synced to Crowdin, where people can help with translations. `Localization/app.json` must be a valid json. -// update resource -./update_localization.sh -``` \ No newline at end of file +## How to update translations + +If there are new translations, Crowdin pushes new commits to a branch called `l10n_develop` and creates a new Pull Request. Both, the branch and the PR might be updated once an hour. The project itself uses a script to generate the various `Localizable.strings`-files etc. for Xcode. + +To add new strings, the workflow is as follows: + +1. Merge the PR with `l10n_develop` into `develop`. +2. Run `update.localization.sh` +3. Commit the changes and push `develop`. + +[crowdin-mastodon-ios]: https://crowdin.com/project/mastodon-for-ios +[crowdin-mastodon-ios-discussions]: https://crowdin.com/project/mastodon-for-ios/discussions \ No newline at end of file