flutter_i18n icon indicating copy to clipboard operation
flutter_i18n copied to clipboard

Error in i18n.dart when using Indonesian locale

Open umutseven92 opened this issue 5 years ago • 10 comments

After adding an .arb file in Indonesian locale (which has the country code in), the plugin adds:

class in extends S {
  const in();
 } 

to generated/i18n.dart file, which fails because in is a reserved keyword in the dart language. Since any changes to i18n.dart gets overridden immediately, right now it is impossible to use this plugin for Indonesian locale.

umutseven92 avatar May 03 '19 14:05 umutseven92

That's an unfortunate bug, and will most probably cause backward-compatibility issues if we add a prefix or suffix to the class names. I guess we have to add special checks for in country code for now.

noordawod avatar May 13 '19 09:05 noordawod

@umutseven92 are you able to submit a pr (Kotlin) to fix this bug?

noordawod avatar May 13 '19 09:05 noordawod

@noordawod Sure, ill take a look as soon as a I am able.

umutseven92 avatar May 13 '19 10:05 umutseven92

@noordawod So I did some digging and turns out this problem also occurred with the Icelandic locale (the country code is in, another reserved keyword). Issue here. It was fixed on 0.2, however since my Intellij version is 2019.1, I can only download version 0.0.6, which is very old. Long story short, I cannot test if the issue persists or not in the latest version. I will come back to this after Issue 53 is solved.

umutseven92 avatar May 13 '19 23:05 umutseven92

I will release a recent version of the plugin for 2019.1 this week. Thanks for taking the time to check this, @umutseven92!

noordawod avatar May 15 '19 06:05 noordawod

@noordawod Some part of your build pipeline seems to be broken. There has not been an update ever since you wrote that comment. I am currently forced to build the plugin locally and set "ideaVersionPrefix=191" manually in the gradle.properties.

Lootwig avatar Jul 18 '19 10:07 Lootwig

@Lootwig Yes, unfortunately this plugin seems to be abandoned (at least for now). Meanwhile I switched to VSCode and am using this plugin.

umutseven92 avatar Jul 18 '19 10:07 umutseven92

@umutseven92 not entirely abandoned, mind you, but the maintainers occasionally need to attend to other important matters in life. In any case, the most recent plugin code is now pushed to JetBrains' repo -- it'll take few days for them to approve it.

noordawod avatar Aug 04 '19 09:08 noordawod

@umutseven92 I am also switching to VSCode and I found the extension you mentionned. The only "problem" is that it misses the option to create string values directly from code. Screen Shot 2019-09-27 at 3 27 54 PM Also, you need to run the update command every time you add a string.

mrkpatchaa avatar Sep 27 '19 14:09 mrkpatchaa

Actually, "in" is deprecated for Indonesian Locale. Locale "id" is more recent for Indonesian.

I found this on window.dart

  // This map is generated by //flutter/tools/gen_locale.dart
  // Mappings generated for language subtag registry as of 2019-02-27.
  static const Map<String, String> _deprecatedLanguageSubtagMap = <String, String>{
    'in': 'id', // Indonesian; deprecated 1989-01-01

samuelg123 avatar Oct 18 '19 09:10 samuelg123