Skip to content

Commit

Permalink
#121 Add missing translation instructions.
Browse files Browse the repository at this point in the history
  • Loading branch information
amugofjava committed Apr 18, 2024
1 parent 0bd9295 commit 95afc2a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions TRANSLATION.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
# Translation

Anytime uses the [intl](https://pub.dev/packages/intl) and [intl_translation](https://pub.dev/packages/intl_translation)
packages for handling string translations, and a custom `LocalizationsDelegate` to allow Anytime to use custom
Anytime uses the [intl](https://pub.dev/packages/intl)
and [intl_translation](https://pub.dev/packages/intl_translation)
packages for handling string translations, and a custom `LocalizationsDelegate` to allow Anytime to
use custom
language resources when required.

All the language resources can be found under the `lib/l10n` directory.

### Translation Process

The translation process requires a few steps: create the language reference in code, generate the ARB
The translation process requires a few steps: create the language reference in code, generate the
ARB
file(s), translate the new strings into the desired locales then generate the language bindings.

#### New locales

If you are translating Anytime into a new language, add the locale to the `supportedLocales` as part of
If you are translating Anytime into a new language, add the locale to the `supportedLocales` as part
of
the `MaterialApp` construction within the main `AnytimePodcastApp` class.

Add the language code to the `isSupported` methods in `L.dart`.

#### Define messages

Check the `L.dart` file to see if it already contains the string you are looking for.

If not, create the new message in `L.dart`. Use an existing message as a template ensuring the message name makes it
If not, create the new message in `L.dart`. Use an existing message as a template ensuring the
message name makes it
clear what/where the message is used.

#### Generate ARB files
Expand All @@ -33,7 +40,8 @@ This will add the new messages to the master `intl_messages.arb` file.

#### Translate ARB files.

Copy the new entries in the `intl_messages.arb` file to the `intl_en.arb` file and the locale file you are translating
Copy the new entries in the `intl_messages.arb` file to the `intl_en.arb` file and the locale file
you are translating
to. Translate the new messages in the locale ARB file.

Once translation is complete, run the following command to generate the language bindings:
Expand Down

0 comments on commit 95afc2a

Please sign in to comment.