google / arb-editor

A VS Code extension to help with .arb files used for translation messages in software.
https://marketplace.visualstudio.com/items?itemName=Google.arb-editor
Apache License 2.0
48 stars 7 forks source link

Allow not escaping with quotes. #42

Closed mosuem closed 1 year ago

mosuem commented 1 year ago

Fixes #41.

It's a good idea to open an issue first for discussion.

DanTup commented 1 year ago

I'm not sure I understand this change (but this may be because I don't understand the arb format :) ). The description at #41 reads like a bug (like a false warning is generated), but this PR just allows disabling the check entirely. Is it not possible to have the check, but allow valid quotes as given in the example (eg., is this not just a bug in the unbalanced quote detection?).

mosuem commented 1 year ago

The arb format uses ICU MessageFormat syntax, which specifies single quotes for escaping. Flutter, which uses the arb format, allows to disable escaping by single quotes (which goes against ICU syntax...). So the extension should respect the YAML file in some way.

DanTup commented 1 year ago

Oh, thanks for the pointer - I thought this was a new yaml file you'd created for this, it makes more sense now :-)

Although, presumably this means that it's important it goes in the project root now (next to pubspec.yaml) for Flutter projects, so I think the workspace folder mentioned above might not be appropriate (because the workspace may have multiple nested projects).

mosuem commented 1 year ago

I will take a look at how the pubspec.yaml is handled in the Dart-Code extension and go from there, thanks!

DanTup commented 1 year ago

If you need to find all projects, Dart-Code does this in the findProjectFolders although there are some options for search depth and exclusions. If you know the arb file you're editing, it might be simpler to walk up and find the nearest project instead (this avoids searching the down the tree which can be quite large), which the Dart-Code extension does in locateBestProjectRoot.

mosuem commented 1 year ago

I tried to keep it somehow Flutter-agnostic, while still supporting Flutter.