Skip to content

Commit

Permalink
release: 5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tienisto committed Sep 17, 2021
1 parent 6ae747e commit fc70d3e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 5.1.0

- feat: add `param_case` configuration to recase parameters

## 5.0.4

- fix: always escape `$` for `braces` and `double_braces`, escape `$` for `dart` if this symbol is alone
Expand Down
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ String g = t['mainScreen.title']; // with fully dynamic key
- [Dynamic Keys](#dynamic-keys)
- [Lists](#lists)
- [Fallback](#fallback)
- [Recasing](#recasing)
- [API](#api)
- [FAQ](#faq)

Expand All @@ -64,7 +65,7 @@ It is recommended to add `fast_i18n` to `dev_dependencies`.
```yaml
dev_dependencies:
build_runner: any
fast_i18n: 5.0.4
fast_i18n: 5.1.0
```
**Step 2: Create JSON files**
Expand Down Expand Up @@ -197,6 +198,7 @@ targets:
enum_name: AppLocale
translation_class_visibility: private
key_case: snake
param_case: pascal
string_interpolation: double_braces
flat_map: false
maps:
Expand Down Expand Up @@ -231,6 +233,7 @@ Key|Type|Usage|Default
`enum_name`|`String`|enum name|`AppLocale`
`translation_class_visibility`|`private`, `public`|class visibility|`private`
`key_case`|`camel`, `pascal`, `snake`|transform keys (optional)|`null`
`param_case`|`camel`, `pascal`, `snake`|transform parameters (optional)|`null`
`string_interpolation`|`dart`, `braces`, `double_braces`|string interpolation mode|`dart`
`flat_map`|`Boolean`|generate flat map|`true`
`maps`|`List<String>`|entries which should be accessed via keys|`[]`
Expand Down Expand Up @@ -574,6 +577,34 @@ targets:
}
```

### Recasing

By default, no transformations will be applied.

You can change that by specifying `key_case` or `param_case`.

Possible cases are: `camel`, `snake` and `pascal`.

```json
{
"this_must_be_camel_case": "But the parameter must be in {snakeCase}"
}
```

```yaml
targets:
$default:
builders:
fast_i18n:
options:
key_case: camel
param_case: snake
```

```dart
t.thisMustBeCamelCase(snake_case: 'snake case');
```

## API

When the dart code has been generated, you will see some useful classes and functions
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: fast_i18n
description: Localization / Internationalization (i18n) solution. Use JSON files to create typesafe translations via source generation.
version: 5.0.4
version: 5.1.0
homepage: https://github.com/Tienisto/flutter-fast-i18n
publish_to: https://pub.dev

Expand Down

0 comments on commit fc70d3e

Please sign in to comment.