Skip to content

Commit

Permalink
Update the CONTRIBUTING.md guide and add a TRANSLATION.md guide.
Browse files Browse the repository at this point in the history
  • Loading branch information
amugofjava committed Feb 27, 2024
1 parent fe936e8 commit c1b3426
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 1.3.7

- Added episode filter.
- Improve transcript responsiveness & speaker matching.

## 1.3.0
Expand Down
51 changes: 27 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]).

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:[email protected]) 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:[email protected]).
- 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:[email protected]) 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

Expand Down
41 changes: 41 additions & 0 deletions TRANSLATION.md
Original file line number Diff line number Diff line change
@@ -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`

0 comments on commit c1b3426

Please sign in to comment.