From c1b3426ced3b8ec1b29f51bb375abe972b81a681 Mon Sep 17 00:00:00 2001 From: Ben Hills Date: Tue, 27 Feb 2024 16:16:00 +0000 Subject: [PATCH] Update the CONTRIBUTING.md guide and add a TRANSLATION.md guide. --- CHANGELOG.md | 1 + CONTRIBUTING.md | 51 ++++++++++++++++++++++++++----------------------- TRANSLATION.md | 41 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 24 deletions(-) create mode 100644 TRANSLATION.md diff --git a/CHANGELOG.md b/CHANGELOG.md index cdb5f47d..72548996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 1.3.7 +- Added episode filter. - Improve transcript responsiveness & speaker matching. ## 1.3.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2ba035b3..c5b88ac3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,30 +17,33 @@ it's that easy! ## Contributing code -When contributing code to this repository, please first discuss the change you wish to make either -via -an [issue](https://github.com/amugofjava/anytime_podcast_player/issues) -or [email](mailto:hello@anytimeplayer.app). - -1. Fork the repo and create a branch from `master`, giving your a branch a descriptive name, for - example `bug/2-bug-name`; if it's a feature/enhancement give it a meaningful name, for - example: `feature/sleep-timer` -2. If you've added code that should be tested: add tests. -3. If the code you are contributing is not trivial, please ensure your code is commented. This not - only helps when reviewing pull requests, but also helps other developers who may be new to the - code. -4. Ensure the test suite passes. -5. Make sure your code lints. -6. Format your code with `dartfmt --line-length 120`. Note that the project uses 120 chars and not - the default 80. Most IDEs will do this for you on save but, if not, you may need to do this - manually. -7. Squash your commits. If you have made several commits, but they are all part of the same bug fix - or feature request, please squash them down to a single commit; this both helps the pull request - approval process and keeps the history cleaner. If you've never squashed commits before there is - a good - article [here](https://medium.com/@slamflipstrom/a-beginners-guide-to-squashing-commits-with-git-rebase-8185cf6e62ec), - or you can reach out to [me](mailto:anytime@amugofjava.me.uk) if you need some help. -8. Issue a pull request. +- If you would like to work on a feature that has been requested or fix a bug that has been reported via an issue, add + a comment to it so that other people know that you are working on it. If you would like to work on a feature that has + not been reported, please first discuss the change you wish to make either + via + an [issue](https://github.com/amugofjava/anytime_podcast_player/issues) + or [email](mailto:hello@anytimeplayer.app). +- Fork the repo and create a branch from `master`. +- If you've added code that should be tested: add tests and ensure they pass. +- If the code you are contributing is non-trivial, please ensure your code is commented. This not + only helps when reviewing pull requests, but also helps other developers who may be new to the + code. +- Make sure your code lints. +- Format your code with `dartfmt --line-length 120`. Note that the project uses 120 chars and not + the default 80. Most IDEs will do this for you on save but, if not, you may need to do this + manually. +- Squash your commits. If you have made several commits, but they are all part of the same logical change, please squash + them down to a single commit; this both helps the pull request + approval process and keeps the history cleaner. If you've never squashed commits before there is + a good + article [here](https://medium.com/@slamflipstrom/a-beginners-guide-to-squashing-commits-with-git-rebase-8185cf6e62ec), + or you can reach out to [me](mailto:anytime@amugofjava.me.uk) if you need some help. +- Issue a pull request. + +## Translating Anytime + +If you would like to translate the app into another language or improve an existing translation, please +take a look at [TRANSLATION.md](TRANSLATION.md) for further details. ## License diff --git a/TRANSLATION.md b/TRANSLATION.md new file mode 100644 index 00000000..d0ee5b4e --- /dev/null +++ b/TRANSLATION.md @@ -0,0 +1,41 @@ +# 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 +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 +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 +the `MaterialApp` construction within the main `AnytimePodcastApp` class. + +#### 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 +clear what/where the message is used. + +#### Generate ARB files + +Open a terminal or command line window and, from the project case, run the following command: + +`dart run intl_translation:extract_to_arb --output-dir=lib/l10n lib/l10n/L.dart` + +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 +to. Translate the new messages in the locale ARB file. + +Once translation is complete, run the following command to generate the language bindings: + +`dart run intl_translation:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/l10n/L.dart lib/l10n/intl_*.arb` \ No newline at end of file