easy_localization icon indicating copy to clipboard operation
easy_localization copied to clipboard

Locale key "zero" not parsed by the easy_localization:generate

Open Floul opened this issue 2 years ago • 4 comments

Key of "zero": "blah blah" doesn’t appear in the generated LocalKeys file. If I change it to "zeron", for example - everything becomes fine. Is zero a reserved name or smth?

Floul avatar Aug 16 '22 13:08 Floul

I'm having the exact same scenario with male, female and other.

Example:

"question_3": {
      "label": "Gender",
      "options": {
        "gender_female": "women",
        "gender_male": "man",
        "gender_other": "other"
      }
    }

produces:

  static const question_3_label = 'question_3.label';
  static const question_3_options_gender_female = 'question_3.options.gender_female';
  static const question_3_options_gender_male = 'question_3.options.gender_male';
  static const question_3_options_gender_other = 'question_3.options.gender_other';
  static const question_3_options = 'question_3.options';

While:

"question_3": {
      "label": "Gender",
      "options": {
        "female": "women",
        "male": "man",
        "other": "other"
      }
    }

produces:

  static const question_3_label = 'question_3.label';
  static const question_3_options = 'question_3.options';

This one about genders is surprisingly weird imho.

briosheje avatar Aug 18 '22 08:08 briosheje

@Floul sounds like these are all reserved words: https://github.com/aissat/easy_localization/blob/develop/bin/generate.dart#L9

Although in the documentation there is an example using male as a key.

I'm feeling confused, but that's why.

briosheje avatar Aug 18 '22 09:08 briosheje

In this case I think it would be nice to see a list of the reserved names.

Floul avatar Aug 18 '22 13:08 Floul

In this case I think it would be nice to see a list of the reserved names.

The list is in the provided link above (in my previous answer).

The current list of reserved names (although I don't know why these are reserved) is:

'few', 'many', 'one', 'other', 'two', 'zero', 'male', 'female',

briosheje avatar Aug 18 '22 13:08 briosheje