Skip to content

Commit

Permalink
docs: add parameter types
Browse files Browse the repository at this point in the history
  • Loading branch information
Tienisto committed Mar 2, 2024
1 parent 4ce2617 commit 3b54c35
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions slang/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 3.30.0

- feat: add parameter types (e.g. `Hello {name: String}, you are {age: int} years old`); is `Object` by default @Tienisto
- fix: handle nested interfaces (#191) @Tienisto
- refactor: move code to src folder @Tienisto

## 3.29.0

- feat: `dart run slang analyze` supports csv files (#185) @nikaera
Expand Down
13 changes: 13 additions & 0 deletions slang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ dart run slang migrate arb src.arb dest.json # migrate arb to json
- [Linked Translations](#-linked-translations)
- [Pluralization](#-pluralization)
- [Custom Contexts / Enums](#-custom-contexts--enums)
- [Typed Parameters](#-typed-parameters)
- [Interfaces](#-interfaces)
- [Modifiers](#-modifiers)
- [Locale Enum](#-locale-enum)
Expand Down Expand Up @@ -883,6 +884,18 @@ contexts:
generate_enum: false # turn off enum generation
```

### ➤ Typed Parameters

Parameters are typed as `Object` by default. This is handy because it offers maximum flexibility.

You can specify the type using the `name: type` syntax to increase type safety.

```json
{
"greet": "Hello {name: String}, you are {age: int} years old"
}
```

### ➤ Interfaces

Often, multiple objects have the same attributes. You can create a common super class for that.
Expand Down

0 comments on commit 3b54c35

Please sign in to comment.