Skip to content

Localizations not generated correctly #127304

@emaborsa

Description

@emaborsa

Is there an existing issue for this?

Steps to reproduce

  1. Create two different localization arb files:
{
    "@@locale" : "en",
    "monthEvents": "Events {date}",
    "@monthEvents": {
        "placeholders": {
            "date":{
                "type": "DateTime",
                "format": "yMMMd"
            }
        }
    }
}
{
    "@@locale" : "de",
    "monthEvents": "Events {date}",
    "@monthEvents": {
        "placeholders": {
            "date":{
                "type": "DateTime",
                "format": "yMd"
            }
        }
    }
}
  1. Run flutter run in order to generate app_localization_en.dart and app_localization_de.dart.

Expected results

Snippet app_localizations_en.dart:

@override
String monthEvents(DateTime date) {
  final intl.DateFormat dateDateFormat = intl.DateFormat.yMMMd(localeName);
  final String dateString = dateDateFormat.format(date);
  return 'Events $dateString';
}

Snippet app_localizations_de.dart:

@override
String monthEvents(DateTime date) {
  final intl.DateFormat dateDateFormat = intl.DateFormat.yMd(localeName);
  final String dateString = dateDateFormat.format(date);
  return 'Events $dateString';
}

Actual results

Snippet app_localizations_en.dart:

@override
String monthEvents(DateTime date) {
  final intl.DateFormat dateDateFormat = intl.DateFormat.yMMMd(localeName);
  final String dateString = dateDateFormat.format(date);
  return 'Events $dateString';
}

Snippet app_localizations_de.dart:

@override
String monthEvents(DateTime date) {
  final intl.DateFormat dateDateFormat = intl.DateFormat.yMMMd(localeName);
  final String dateString = dateDateFormat.format(date);
  return 'Events $dateString';
}

Notice: en is OK, for de I expected yMd instead of yMMMd

Code sample

There is no runnable code.

Screenshots or Video

No response

Logs

Have no logs, neither errors.

Flutter Doctor output

[√] Flutter (Channel stable, 3.7.10, on Microsoft Windows [Version 10.0.19044.2965], locale de-DE)
• Flutter version 3.7.10 on channel stable at C:\Source\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4b12645 (7 weeks ago), 2023-04-03 17:46:48 -0700
• Engine revision ec975089ac
• Dart version 2.19.6
• DevTools version 2.20.1

[X] Windows Version (Unable to confirm if installed Windows version is 10 or greater)

Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at C:\Users\eborsoi\AppData\Local\Android\Sdk
• Platform android-33-ext4, build-tools 33.0.1
• ANDROID_HOME = C:\Users\eborsoi\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.5.5)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.5.33627.172
• Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2022.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[√] VS Code, 64-bit edition (version 1.78.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.64.0

[√] Connected device (4 available)
• EML L09 (mobile) • BPN0219301001602 • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.2965]
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.93
• Edge (web) • edge • web-javascript • Microsoft Edge 113.0.1774.50

[√] HTTP Host Availability
• All required HTTP hosts are available

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)found in release: 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions