I have a flutter project, and updated it to nullsafety just now. And I found that intl_translation plugin are not support for nullsafety. So I remove it and want to use the intl comes with the framwork of flutter.
According to the official documents, I add 2 lines: intl: ^0.17.0 #
, generate: true
and new a file named l10n.yaml
.
l10n.yaml 's content as follow:
arb-dir: lib/l10n
template-arb-file: intl_en.arb
output-localization-file: lib/generated/intl/l10n.dart
Then my file tree as follow:
lib
├── data
│ ├── ......
├── generated
│ ├── intl
│ │ ├── messages_all.dart
│ │ ├── messages_en.dart
│ │ └── messages_zh.dart
│ └── l10n.dart
├── l10n
│ ├── intl_en.arb
│ └── intl_zh.arb
├── ......
├── ......
├── ui
│ ├── ......
└── utilities.dart
Then I flutter run
my project. The ERRORS show that
Invalid ARB resource name "UPCredit" in LocalFile: '.../lib/l10n/intl_en.arb'.
Resources names must be valid Dart method names: they have to be camel case, cannot start with a number or underscore, and cannot contain non-alphanumeric characters.
Generating synthetic localizations package has failed.
The error position is in my intl_en.arb
as follows:
"UPxxt": "Uxxx Cxxxit",
"UPxit": "Unxxx Dxxxt",
"UPSxit": "Uxxx Sxxxed xxxit",
MY PROBLEM: NoBody talk me not to do like this(Maybe I can not find something about it). Can anybody help me about how to solve it? Something about document(how to find this?).
Basically, the means exactly camelCase
this kind of naming convention to be used hence you'll need to stick with upCredit
instead of UpCredit
.