New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generated l10n file is missing 'intl' import with Flutter 2.2.0 #83102
Comments
Hi @SebastianEngel I am using a sample from here flutter doctor -v[✓] Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version 10.0.19043.985], locale en-US)
• Flutter version 2.2.0 at C:\Users\Taha\Code\flutter_stable
• Framework revision b22742018b (9 days ago), 2021-05-14 19:12:57 -0700
• Engine revision a9d88a4d18
• Dart version 2.13.0
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Taha\Code\SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = C:\Users\Taha\Code\SDK
• Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java.exe
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• 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 2019 16.9.6)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31313.79
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[✓] VS Code (version 1.56.2)
• VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0
[✓] Connected device (5 available)
• Redmi K20 Pro (mobile) • def0ad20 • android-arm64 • Android 10 (API 29)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.985]
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.66
! Doctor found issues in 1 category. Can you please try the code sample and reproduce the issue |
Hi @TahaTesser, it seems like these samples are very basic and don't use any DateTime placeholders, right? I do have something like this in my localizations:
The generated code looks like this:
That's a case when the 'intl' import is required and which breaks with Flutter 2.2.0. |
Hi @SebastianEngel import 'package:intl/intl.dart' as intl;
import 'app_localizations.dart';
/// The translations for English (`en`).
class AppLocalizationsEn extends AppLocalizations {
AppLocalizationsEn([String locale = 'en']) : super(locale);
@override
String helloWorld(DateTime date) {
final intl.DateFormat dateDateFormat = intl.DateFormat.yMMMEd(localeName);
final String dateString = dateDateFormat.format(date);
return 'Hello World!';
}
} Tested the code sample on the following channels
Check flutter doctor -v[✓] Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version 10.0.19043.985], locale en-US)
• Flutter version 2.2.0 at C:\Users\Taha\Code\flutter_stable
• Framework revision b22742018b (10 days ago), 2021-05-14 19:12:57 -0700
• Engine revision a9d88a4d18
• Dart version 2.13.0
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Taha\Code\SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = C:\Users\Taha\Code\SDK
• Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java.exe
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• 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 2019 16.9.6)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31313.79
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[✓] VS Code (version 1.56.2)
• VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0
[✓] Connected device (4 available)
• Redmi K20 Pro (mobile) • def0ad20 • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.985]
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.66
! Doctor found issues in 1 category. [✓] Flutter (Channel beta, 2.2.0, on Microsoft Windows [Version 10.0.19043.985], locale en-US)
• Flutter version 2.2.0 at C:\Users\Taha\Code\flutter_beta
• Framework revision b22742018b (10 days ago), 2021-05-14 19:12:57 -0700
• Engine revision a9d88a4d18
• Dart version 2.13.0
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Taha\Code\SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = C:\Users\Taha\Code\SDK
• Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java.exe
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• 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 2019 16.9.6)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31313.79
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[✓] VS Code (version 1.56.2)
• VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0
[✓] Connected device (4 available)
• Redmi K20 Pro (mobile) • def0ad20 • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.985]
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.66
! Doctor found issues in 1 category. [✓] Flutter (Channel dev, 2.3.0-12.1.pre, on Microsoft Windows [Version 10.0.19043.985], locale en-US)
• Flutter version 2.3.0-12.1.pre at C:\Users\Taha\Code\flutter_dev
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f9c825981c (6 days ago), 2021-05-18 14:07:52 -0700
• Engine revision 26e217e6c3
• Dart version 2.14.0 (build 2.14.0-edge.a527411e5100a0a4f48c4009087a1b988aa784af)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Taha\Code\SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = C:\Users\Taha\Code\SDK
• Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• 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 2019 16.9.6)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31313.79
• Windows 10 SDK version 10.0.19041.0
[✓] Android Studio (version 4.2.0)
• Android Studio at C:\Users\Taha\Code\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.8+10-b944.6842174)
[✓] VS Code (version 1.56.2)
• VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0
[✓] Connected device (5 available)
• Redmi K20 Pro (mobile) • def0ad20 • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.985]
• Windows (UWP) (desktop) • winuwp • windows-uwp-x64 •
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.66
• No issues found! [✓] Flutter (Channel master, 2.3.0-13.0.pre.145, on Microsoft Windows [Version 10.0.19043.985], locale en-US)
• Flutter version 2.3.0-13.0.pre.145 at C:\Users\Taha\Code\flutter_master
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fdb1fb184d (3 hours ago), 2021-05-24 22:04:02 -0700
• Engine revision b1385c0df1
• Dart version 2.14.0 (build 2.14.0-145.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Taha\Code\SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = C:\Users\Taha\Code\SDK
• Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• 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 2019 16.9.6)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31313.79
• Windows 10 SDK version 10.0.19041.0
[✓] Android Studio (version 4.2.0)
• Android Studio at C:\Users\Taha\Code\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.8+10-b944.6842174)
[✓] VS Code (version 1.56.2)
• VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0
[✓] Connected device (5 available)
• Redmi K20 Pro (mobile) • def0ad20 • android-arm64 • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.985]
• Windows (UWP) (desktop) • winuwp • windows-uwp-x64 •
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.66
• No issues found! ✅ : No Issue ❌: Has issue Can you please upgrade to the latest |
@TahaTesser Thank you for that quick action. Looks good, just tried it 👍🏻 Since without this fix it's not possible to switch to 2.2.0 when having DateTimes in localizations, does this fix qualify for a hotfix on stable? |
Regarding #83102 (comment) |
@HansMuller what do you think, does this necessitate a cherry-pick request? And if so, can you determine where it was fixed? |
Problem is in gen_l10n.dart file: So a workaround is to add a dummy plurals string to your arb file. |
@goderbauer - this looks similar to #82713 which you fixed in #83122. Could you take a look? |
This issue was fixed in #83122 and should not appear on master. I think this would be a worthwhile cherry-pick. I'll add the label to request it. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
After upgrading my Flutter SDK to 2.2.0 the generated localization file is missing the 'intl' import which leads to the following error:
Before upgrading to 2.2.0 (was 2.0.6):
After upgrading to 2.2.0:
Flutter doctor:
The text was updated successfully, but these errors were encountered: