Skip to content

[web] Locale is returning "en_" if country code is empty string #176666

@math1man

Description

@math1man

Steps to reproduce

  1. Create two locales one = Locale('en') and two = Locale('en', '')
  2. Log both

This is an exact duplicate of #43607. That issue was fixed for native platforms but not for web platforms. The same fix should be applied to https://github.com/flutter/flutter/blob/master/engine/src/flutter/lib/web_ui/lib/platform_dispatcher.dart and https://github.com/flutter/flutter/blob/master/engine/src/flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart

Expected results

Both should print as en.

Actual results

See that one is en and two is en_

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  print(Locale('en'));
  print(Locale('en', ''));
}

Can be run in dartpad

Screenshots or Video

N/A

Logs

N/A

Flutter Doctor output

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: internationalizationSupporting other languages or locales. (aka i18n)c: parityWorks on one platform but not anothercustomer: googleVarious Google teamscustomer: huggsy (g3)engineflutter/engine related. See also e: labels.found in release: 3.35Found to occur in 3.35found in release: 3.37Found to occur in 3.37frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions