这是indexloc提供的服务,不要输入任何密码
Skip to content

Default Locale problem #1026

@glanium

Description

@glanium

Default locale always fails.

  final intl = Intl();  // <-- without locale

This code always cause problem.

Intl class implementaion is as follows

class Intl {
  Locale locale;

  /// Construct an [Intl] instance providing the current [locale].
  Intl({Locale? locale}) : locale = locale ?? findSystemLocale();

then findSystemLocale is as follows

Locale findSystemLocale() {
  try {
    return Locale.parse(Platform.localeName);
  } catch (e) {
    return Locale.parse('und');
  }
}

Platform.localeName returns locale name which uses _ as separator like en_US and so on

but it seems icu4x only accepts -(hypen) as locale name separator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:intl4xtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions