Skip to content

Commit

Permalink
Add information about unexpected normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
erikaxel authored May 10, 2024
1 parent 2a9a9e0 commit 09d68c9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,27 @@ See the full list of tasks with `i18n-tasks --help`.
✔ Reference keys (keys with `:symbol` values) are fully supported. These keys are copied as-is in
`add/translate-missing`, and can be looked up by reference or value in `find`.

#### Unexpected normalization
`i18n-tasks` uses a yaml parser and emitter called `Psych` under the hood. `Psych` has it's own heuristic on when
to use `|`, `>`, or `""` for multi-line strings. This can have some unexpected consequences, eg when normalizing:
```yaml
a: |
Lorem ipsum dolor sit amet, consectetur
Lorem ipsum dolor sit amet, consectetur
b: |
Lorem ipsum dolor sit amet, consectetur
Lorem ipsum dolor sit amet, consectetur
```
we get the result
```yaml
a: |
Lorem ipsum dolor sit amet, consectetur
Lorem ipsum dolor sit amet, consectetur
b: "Lorem ipsum dolor sit amet, consectetur \nLorem ipsum dolor sit amet, consectetur\n"
```
The only difference between `a` and `b` is that `a` has an extra space in the first line.
This is an unfortunate side effect of `i18n-tasks` using `Psych`.

#### `t()` keyword arguments

✔ `scope` keyword argument is fully supported by the AST scanner, and also by the Regexp scanner but only when it is the first argument.
Expand Down

0 comments on commit 09d68c9

Please sign in to comment.