Skip to content

default script code for "zh" should be "Hant", not "Hans" #26941

@seventhmoon

Description

@seventhmoon

in localizations_utils.dart, the default script code for "zh" is "Hans".

However, in Chinese Language, Traditional Chinese "Hant" is the main set. "Hans" is a override for around 2000 Character in the main set and is only used in a few countries (although with large population size).

From academic and system point of view, the default script code here for "zh" should be "Hant", not "Hans".

/// Adds scriptCodes to locales where we are able to assume it to provide
/// finer granularity when resolving locales.
///
/// The basis of the assumptions here are based off of known usage of scripts
/// across various countries. For example, we know Taiwan uses traditional (Hant)
/// script, so it is safe to apply (Hant) to Taiwanese languages.
if (assume && scriptCode == null) {
  switch (languageCode) {
    case 'zh': {
      if (countryCode == null) {
        scriptCode = 'Hans';
      }
      switch (countryCode) {
        case 'CN':
        case 'SG':
          scriptCode = 'Hans';
          break;
        case 'TW':
        case 'HK':
        case 'MO':
          scriptCode = 'Hant';
          break;
      }
      break;
    }
    case 'sr': {
      if (countryCode == null) {
        scriptCode = 'Cyrl';
      }
      break;
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: internationalizationSupporting other languages or locales. (aka i18n)frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions