localizely/flutter-intl-vscode

Not generate when key is "continue"

pro100andrey opened this issue · 2 comments

For example:
File name is intl_en.arb

{
  "continue": "Продолжить"
}

VSCode output:

INFO: Generating localization files for the 'core' project...
INFO: Failed to format 'l10n.dart' file.
Error in parsing /Users/.../packages/core/lib/generated/l10n.dart, no messages extracted.
ERROR: Failed to generate localization files.
Invalid argument(s): Parsing errors in /Users/...packages/core/lib/generated/l10n.dart
pub finished with exit code 2
exit code 2

For example: if change the key 'continue' into 'goOn'

{
    "goOn": "Продолжить"
}

all works!

Hi @pro100andrey,

The continue is a reserved keyword in Dart, and as such, it can't be used as an identifier. The same applies to other reserved keywords like for, break, return, and similar.

You can find more info here.

Maybe renaming (e.g. goOn) or adding a prefix (e.g. commonContinue) to the string key would be the right way to go.

@lzoran Thanks for your answer.

In my opinion, flutter-intl-vscode documentation should contain a paragraph about keywords, because this is unpredictable for users.

Thanks!