Skip to content

Locale is returning en_ if country code is empty string #43607

@IchordeDionysos

Description

@IchordeDionysos

Steps to Reproduce

  1. Create two locales one = Locale("en") and two = Locale("en", "")
  2. Log both
  3. See that one is "en" and two is "en_"

Additional Info and thoughts

This happens on an iOS simulator with the default locale.

I did some research and in this code: https://github.com/flutter/engine/blob/master/lib/ui/window.dart#L511
There should be an additional check if the scriptCode or the _countryCode is an empty string because "en_" is not a valid Unicode BCP47 Locale Identifier

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: internationalizationSupporting other languages or locales. (aka i18n)engineflutter/engine related. See also e: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions