mobile/apps/photos/docs/translations.md
We use Crowdin for translations, and the intl package to load these at
runtime.
Within our project we have the source strings - these are the key value pairs
in the lib/l10n/intl_en.arb file.
Volunteers can add a new translation in their language corresponding to each such source key-value to our Crowdin project.
When a new source string is added, we run a GitHub workflow that
intl_en.arb becomes available to translators to translate.Every monday, we run a GitHub workflow that
intl_XX.arb.The workflow also uploads existing translations and also downloads new sources from Crowdin, but these two should be no-ops.
Add the key-value pair to lib/l10n/intl_en.arb
Example:
{
"existingKey": "Existing translation",
"newStringKey": "Your new string text"
}
(optional) Add context or description to help translators:
{
"newStringKey": "Your new string text",
"@newStringKey": {
"description": "Context about where/how this string is used"
}
}
Run flutter gen-l10n to regenerate the localization files (or run flutter pub get which triggers this automatically)
Import the localization in your Dart file:
import "package:photos/generated/l10n.dart";
Use the string in your code:
AppLocalizations.of(context).newStringKey
Commit the changes and create a PR in which it is advised to tag at least one of the developers (i.e. laurenspriem)
During the next sync, the workflow will upload new source strings to Crowdin's dashboard, allowing translators to translate it.
intl_en.arb.intl_en.arb.intl_XX.arb files in the repository).