Skip to content

Commit

Permalink
docs: Improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
LeadcodeDev committed Dec 11, 2022
1 parent 13fd8dd commit 59d9c22
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ Then we can use the `t()` function to translate our key path.
```dart
import 'package:mineral_i18n/mineral_i18n.dart';
final String sentence = t(Lang.fr, 'foo.bar');
print(sentence); // bar en français !
class Foo extends MineralEvent<Ready> with Translation {
Future<void> handle (Ready event) async {
final String sentence = t(Lang.fr, 'foo.bar');
print(sentence); // bar en français !
final String sentence = t(Lang.en_GB, 'foo.bar');
print(sentence); // bar in english !
final String sentence = t(Lang.en_GB, 'foo.bar');
print(sentence); // bar in english !
}
}
```

## Injecting variables
Expand All @@ -61,6 +65,10 @@ Our string is now waiting for a variable named xx which we will give it when we
```dart
import 'package:mineral_i18n/mineral_i18n.dart';
final String sentence = t(Lang.en_GB, 'foo.bar', { 'framework': 'Mineral' });
print(sentence); // Mineral is my favourite framework !
class Foo extends MineralEvent<Ready> with Translation {
Future<void> handle (Ready event) async {
final String sentence = t(Lang.en_GB, 'foo.bar', { 'framework': 'Mineral' });
print(sentence); // Mineral is my favourite framework !
}
}
```

0 comments on commit 59d9c22

Please sign in to comment.