Add a little documentation on how to L10n (#539)

This commit is contained in:
Nathan Mattes 2022-11-09 12:23:38 +01:00
parent b5943d48cf
commit 81094c6676
1 changed files with 23 additions and 12 deletions

View File

@ -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
```
## 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