Skip to content

Commit

Permalink
Example updated
Browse files Browse the repository at this point in the history
  • Loading branch information
lcapeng committed Apr 18, 2020
1 parent 5020786 commit 4f6bac1
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
11 changes: 11 additions & 0 deletions example/assets/langs/en.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"123": "Numeric label",
"CLICKED": {
"zero": "You clicked {} times!",
"one": "You clicked {} time!",
"two": "You clicked {} times!",
"few": "You clicked {} times!",
"many": "You clicked {} times!",
"other": "You clicked {} times!"
},
"HELLO": "Hi!",
"ERROR": {
"WRONG_USERNAME": "Wrong username",
"WRONG_PASSWORD": "Wrong password"
},
"LABEL.WITH:SYMBOLS": "Label with symbols",
"LABEL WITH SPACES": "Label with spaces",
"OTHER_LABEL": "Only in english"
}
13 changes: 12 additions & 1 deletion example/assets/langs/it.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
{
"123": "Etichetta numerica",
"CLICKED": {
"zero": "Hai cliccato {} volta!",
"one": "Hai cliccato {} volte!",
"two": "Hai cliccato {} volte!",
"few": "Hai cliccato {} volte!",
"many": "Hai cliccato {} volte!",
"other": "Hai cliccato {} volte!"
},
"HELLO": "Ciao!",
"ERROR": {
"WRONG_USERNAME": "Username errato",
"WRONG_PASSWORD": "Password errata"
}
},
"LABEL.WITH:SYMBOLS": "Etichetta con simboli",
"LABEL WITH SPACES": "Etichetta con spazi"
}
13 changes: 13 additions & 0 deletions example/lib/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,18 @@ library example;
import 'package:example/i18n/translations_keychain.dart';

void main() {
// Simple label
print(TranslationsKeychain.HELLO);

// Label with numbers
print(TranslationsKeychain.A_123);

// Label with spaces
print(TranslationsKeychain.LABEL_WITH_SPACES);

// Label with symbols
print(TranslationsKeychain.LABEL_WITH_SYMBOLS);

// Label with pluralization with [easy_localization] package
// print(TranslationsKeychain.CLICKED.plural(counter));
}
11 changes: 11 additions & 0 deletions example/lib/i18n/translations_keychain.dart

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

3 changes: 2 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ environment:

dev_dependencies:
build_runner: ^1.8.1
translations_keychain: ^0.0.2
translations_keychain:
path: ../

0 comments on commit 4f6bac1

Please sign in to comment.