Skip to content

Commit

Permalink
Merge pull request #12 from JuribaDev/update_readme
Browse files Browse the repository at this point in the history
update README file
  • Loading branch information
JuribaDev authored Oct 31, 2023
2 parents e8130c9 + 1ed5f0f commit ca98b98
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 162 deletions.
35 changes: 14 additions & 21 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

126 changes: 11 additions & 115 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ This project contains 3 flavors:
- staging
- production

To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the following commands:
To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the
following commands:

```sh
# Development
Expand All @@ -43,7 +44,8 @@ To run all unit and widget tests use the following command:
$ flutter test --coverage --test-randomize-ordering-seed random
```

To view the generated coverage report you can use [lcov](https://github.com/linux-test-project/lcov).
To view the generated coverage report you can
use [lcov](https://github.com/linux-test-project/lcov).

```sh
# Generate Coverage Report
Expand All @@ -53,124 +55,18 @@ $ genhtml coverage/lcov.info -o coverage/
$ open coverage/index.html
```

---

## Working with Translations 🌐

This project relies on [flutter_localizations][flutter_localizations_link] and follows the [official internationalization guide for Flutter][internationalization_link].

### Adding Strings

1. To add a new localizable string, open the `app_en.arb` file at `lib/l10n/arb/app_en.arb`.

```arb
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
}
}
```

2. Then add a new key/value and description

```arb
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
},
"helloWorld": "Hello World",
"@helloWorld": {
"description": "Hello World Text"
}
}
```

3. Use the new string

```dart
import 'package:ny_articles_clean_architecture/l10n/l10n.dart';
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return Text(l10n.helloWorld);
}
```

### Adding Supported Locales

Update the `CFBundleLocalizations` array in the `Info.plist` at `ios/Runner/Info.plist` to include the new locale.

```xml
...

<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>es</string>
</array>

...
```

### Adding Translations

1. For each supported locale, add a new ARB file in `lib/l10n/arb`.

```
├── l10n
│ ├── arb
│ │ ├── app_en.arb
│ │ └── app_es.arb
```

2. Add the translated strings to each `.arb` file:

`app_en.arb`

```arb
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
}
}
```

`app_es.arb`

```arb
{
"@@locale": "es",
"counterAppBarTitle": "Contador",
"@counterAppBarTitle": {
"description": "Texto mostrado en la AppBar de la página del contador"
}
}
```

### Generating Translations

To use the latest translations changes, you will need to generate them:

1. Generate localizations for the current project:

```sh
flutter gen-l10n --arb-dir="lib/l10n/arb"
```

Alternatively, run `flutter run` and code generation will take place automatically.

[coverage_badge]: coverage_badge.svg

[flutter_localizations_link]: https://api.flutter.dev/flutter/flutter_localizations/flutter_localizations-library.html

[internationalization_link]: https://flutter.dev/docs/development/accessibility-and-localization/internationalization

[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg

[license_link]: https://opensource.org/licenses/MIT

[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg

[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis

[very_good_cli_link]: https://github.com/VeryGoodOpenSource/very_good_cli
4 changes: 0 additions & 4 deletions l10n.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions lib/l10n/arb/app_en.arb

This file was deleted.

7 changes: 0 additions & 7 deletions lib/l10n/arb/app_es.arb

This file was deleted.

8 changes: 0 additions & 8 deletions lib/l10n/l10n.dart

This file was deleted.

0 comments on commit ca98b98

Please sign in to comment.