π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Consolidate mobile translation docs
Manav Rathi58636012c050
diff --git a/mobile/apps/auth/README.md b/mobile/apps/auth/README.mdindex 635a8321a4..33b0d0ab59 100644--- a/mobile/apps/auth/README.md+++ b/mobile/apps/auth/README.md@@ -48,8 +48,6 @@ You can view your 2FA codes at [auth.ente.com](https://auth.ente.com). For addinTo build a release APK, [setup your keystore](https://docs.flutter.dev/deployment/android#create-an-upload-keystore) and run `flutter build apk --release --flavor independent`. For iOS, use `flutter build ios`.-If the code you're working needs to modify user facing strings, see [docs/localization](docs/localization.md).-### Updating dependenciesAfter updating Flutter dependencies, run `pod install` from `ios/` on macOS and commit `ios/Podfile.lock` if it changes.@@ -62,9 +60,7 @@ The architecture that powers end-to-end encrypted storage and sync of your token[](https://crowdin.com/project/ente-photos-app)-If you're interested in helping out with translation, please visit our [Crowdin project](https://crowdin.com/project/ente-photos-app) to get started. Thank you for your support.--If your language is not listed for translation, please [create a GitHub issue](https://github.com/ente/ente/issues/new?title=Request+for+New+Language+Translation&body=Language+name%3A) to have it added.+If you're interested in helping out with translation, please visit our [Crowdin project](https://crowdin.com/project/ente-photos-app). For more details, see the docs for the [strings package](../../packages/strings/README.md).## π§βπ¨ Iconsdiff --git a/mobile/apps/auth/docs/localization.md b/mobile/apps/auth/docs/localization.mddeleted file mode 100644index df957a0a19..0000000000--- a/mobile/apps/auth/docs/localization.md+++ /dev/null@@ -1,17 +0,0 @@-## Localization--If the feature requires adding new strings, you can do that by following these steps:--1. Add a new entry inside [strings_en.arb](https://github.com/ente/ente/blob/main/mobile/packages/strings/lib/l10n/arb/strings_en.arb).--2. In your dart file, add the following import-- ```dart- import "package:ente_strings/ente_strings.dart";- ```--3. Refer to the string using `context.strings.<keyName>`. For example-- ```dart- context.strings.account- ```diff --git a/mobile/apps/locker/README.md b/mobile/apps/locker/README.mdindex fa4fc61a83..35edcf395e 100644--- a/mobile/apps/locker/README.md+++ b/mobile/apps/locker/README.md@@ -22,6 +22,4 @@ After updating Flutter dependencies, run `pod install` from `ios/` on macOS and[](https://crowdin.com/project/ente-photos-app)-If you're interested in helping out with translation, please visit our [Crowdin project](https://crowdin.com/project/ente-photos-app) to get started. Thank you for your support.--If your language is not listed for translation, please [create a GitHub issue](https://github.com/ente/ente/issues/new?title=Request+for+New+Language+Translation&body=Language+name%3A) to have it added.+If you're interested in helping out with translation, please visit our [Crowdin project](https://crowdin.com/project/ente-photos-app). For more details, see the docs for the [strings package](../../packages/strings/README.md).diff --git a/mobile/apps/photos/README.md b/mobile/apps/photos/README.mdindex dd935bf593..b0150812b4 100644--- a/mobile/apps/photos/README.md+++ b/mobile/apps/photos/README.md@@ -61,16 +61,6 @@ To build a release APK, [setup your keystore](https://docs.flutter.dev/deploymenAfter updating Flutter dependencies, run `pod install` from `ios/` on macOS and commit `ios/Podfile.lock` if it changes.-## π Localization--Mobile apps share Flutter's localization package in `mobile/packages/strings`.--- The base localization file is `mobile/packages/strings/lib/l10n/arb/strings_en.arb`-- Generated code appears in `mobile/packages/strings/lib/l10n/`-- To manually regenerate, run `flutter gen-l10n` from `mobile/packages/strings`--See [docs/translations.md](docs/translations.md) for contributing translations.-## ποΈ AttributionsCity coordinates from [Simple Maps](https://simplemaps.com/data/world-cities)@@ -79,9 +69,7 @@ City coordinates from [Simple Maps](https://simplemaps.com/data/world-cities)[](https://crowdin.com/project/ente-photos-app)-If you're interested in helping out with translation, please visit our [Crowdin project](https://crowdin.com/project/ente-photos-app) to get started. Thank you for your support.--If your language is not listed for translation, please [create a GitHub issue](https://github.com/ente/ente/issues/new?title=Request+for+New+Language+Translation&body=Language+name%3A) to have it added.+If you're interested in helping out with translation, please visit our [Crowdin project](https://crowdin.com/project/ente-photos-app). For more details, see the docs for the [strings package](../../packages/strings/README.md).## π Contributediff --git a/mobile/apps/photos/docs/translations.md b/mobile/apps/photos/docs/translations.mddeleted file mode 100644index 784dc88d67..0000000000--- a/mobile/apps/photos/docs/translations.md+++ /dev/null@@ -1,79 +0,0 @@-# Translations--We use Crowdin for translations and Flutter's localization generator to load them at runtime.--All mobile apps share the source strings in `mobile/packages/strings/lib/l10n/arb/strings_en.arb`.--Volunteers can add a new _translation_ in their language corresponding to each such source key-value to our [Crowdin project](https://crowdin.com/project/ente-photos-app).--When a new source string is added, a [GitHub workflow](../../../../.github/workflows/mobile-crowdin-push-sources.yml) uploads it to Crowdin.--Every Monday, we run a [GitHub workflow](../../../../.github/workflows/mobile-crowdin-sync.yml) that--- Downloads translations from Crowdin into the corresponding `strings_XX.arb`.--The sync workflow also uploads the current source strings before downloading translations.--## Adding a new string--1. Add the key-value pair to `mobile/packages/strings/lib/l10n/arb/strings_en.arb`.-- Example:-- ```json- {- "existingKey": "Existing translation",- "newStringKey": "Your new string text"- }- ```--1. (optional) Add context or description to help translators:-- ```json- {- "newStringKey": "Your new string text",- "@newStringKey": {- "description": "Context about where/how this string is used"- }- }- ```--1. Run `flutter gen-l10n` from `mobile/packages/strings`.--1. Import the localization in your Dart file:-- ```dart- import "package:ente_strings/ente_strings.dart";- ```--1. Use the string in your code:-- ```dart- context.strings.newStringKey- ```--1. Commit the changes and create a PR in which it is advised to tag at least one of the developers (i.e. [laurenspriem](https://github.com/laurenspriem))--1. After the PR is merged, the source-push workflow will upload new source strings to Crowdin's dashboard, allowing translators to translate it.--## Plurals--Use plural categories `one` and `other` in source ARBs, not `=1`.--```json-"photosCount": "{count, plural, =0{No photos} one{{count} photo} other{{count} photos}}"-```--`=0`, `one`, and `other` can be used together. Exact selectors win first; `one` is a locale category, not always exactly `1`. When showing the number in the `one` branch, use the count placeholder instead of hardcoding `1`.--## Updating an existing string--1. Update the existing value for the key in `mobile/packages/strings/lib/l10n/arb/strings_en.arb`.-1. Commit the changes and create a PR in which it is advised to tag at least one of the developers (i.e. [laurenspriem](https://github.com/laurenspriem))-1. After the PR is merged, the source-push workflow will upload the changed source strings to Crowdin's dashboard, allowing translators to translate it.--## Deleting an existing string--1. Remove the key value pair from `mobile/packages/strings/lib/l10n/arb/strings_en.arb`.-1. Commit the changes and create a PR in which it is advised to tag at least one of the developers (i.e. [laurenspriem](https://github.com/laurenspriem))-1. After the PR is merged, the source-push workflow will update Crowdin. During the next sync, the workflow will remove that source item from the other `strings_XX.arb` files in the repository.diff --git a/mobile/packages/strings/README.md b/mobile/packages/strings/README.mdnew file mode 100644index 0000000000..9dabe78402--- /dev/null+++ b/mobile/packages/strings/README.md@@ -0,0 +1,71 @@+# Ente strings++This package contains the user-facing strings and translations shared by the Auth, Locker, and Photos apps. Flutter's localization generator turns the ARB files in `lib/l10n/arb` into the Dart files in `lib/l10n`.++## Translate++The strings can be translated in the [Ente Mobile Crowdin project](https://crowdin.com/project/ente-photos-app).++If your language is not listed, [request it on GitHub](https://github.com/ente/ente/issues/new?title=Request+for+New+Language+Translation&body=Language+name%3A+%0AProject%3A+mobile).++Partial translations are welcome; apps generally enable a language after about 90% of their reachable strings are translated.++## Add a string++1. Add the key and English text to [`strings_en.arb`](lib/l10n/arb/strings_en.arb):++ ```json+ {+ "existingKey": "Existing text",+ "newStringKey": "Your new string text"+ }+ ```++2. Run `flutter gen-l10n` from `mobile/packages/strings`.++3. Import the package in the app code:++ ```dart+ import "package:ente_strings/ente_strings.dart";+ ```++4. Read the string from a `BuildContext`:++ ```dart+ context.strings.newStringKey+ ```++5. Commit the ARB and app changes.++After the pull request merges, the [source workflow](../../../.github/workflows/mobile-crowdin-push-sources.yml) will upload the new string to Crowdin.++## Plurals++Use the locale-aware `one` and `other` categories instead of `=1`:++```json+"photosCount": "{count, plural, =0{No photos} one{{count} photo} other{{count} photos}}"+```++`=0`, `one`, and `other` can be used together. Exact selectors are evaluated first; `one` is a locale category and does not always mean exactly `1`. When displaying the number, use the placeholder rather than hardcoding it in a plural branch.++## Update a string++> [!WARNING]+>+> Updating a source string (English) invalidates _all_ its translations.++1. Update its English text in [`strings_en.arb`](lib/l10n/arb/strings_en.arb).+2. Run `flutter gen-l10n` from `mobile/packages/strings`.+3. Commit the ARB change.++After the pull request merges, the source workflow will update the string in Crowdin.++## Delete a string++1. Remove or replace every use of the string in the app code.+2. Remove its value and any corresponding `@key` entry from [`strings_en.arb`](lib/l10n/arb/strings_en.arb).+3. Run `flutter gen-l10n` from `mobile/packages/strings`.+4. Commit the ARB and app changes.++After the pull request merges, the source workflow will remove the string from Crowdin. The next translation sync will remove it from the translated ARB files.