flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
162.54k stars 26.72k forks source link

Some of the buttons on the toolbar are not localized #145448

Closed SShayashi closed 2 months ago

SShayashi commented 2 months ago

Summary

Some of the toolbar buttons that appear when selecting text are not localized. The first four buttons (Cut, Copy, Paste and Look Up) are localized and displayed in Japanese, but the Search Web and `Share... buttons are not localized.

First Buttons Second Buttons Third Buttons
sample ```dart import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( localizationsDelegates: const [ GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: const [ Locale('en', ''), // English, no country code Locale('ja', ''), // Japanese, no country code // 他のロケールを追加する ], home: Scaffold( appBar: AppBar( title: const Text('Sample App'), ), body: const Center( child: MyCustomForm(), ), ), ); } } class MyCustomForm extends StatefulWidget { const MyCustomForm({super.key}); @override MyCustomFormState createState() { return MyCustomFormState(); } } class MyCustomFormState extends State { final myController = TextEditingController(); @override void dispose() { // Clean up the controller when the widget is disposed. myController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.all(16.0), child: TextField( controller: myController, ), ); } } ```
pubspec.yaml ```yaml name: try_localizations description: "A new Flutter project." publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: sdk: '>=3.2.0 <4.0.0' dependencies: flutter: sdk: flutter flutter_localizations: sdk: flutter cupertino_icons: ^1.0.2 dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^2.0.0 flutter: uses-material-design: true ```
flutter doctor -v ``` ➜ try_roboto_font git:(main) flutter doctor -v [✓] Flutter (Channel stable, 3.16.0, on macOS 13.4 22F66 darwin-arm64, locale ja-JP) • Flutter version 3.16.0 on channel stable at /Users/01036096/fvm/versions/3.16.0 • Upstream repository https://github.com/flutter/flutter.git • Framework revision db7ef5bf9f (4 months ago), 2023-11-15 11:25:44 -0800 • Engine revision 74d16627b9 • Dart version 3.2.0 • DevTools version 2.28.2 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/01036096/Library/Android/sdk • Platform android-33, build-tools 33.0.2 • ANDROID_HOME = /Users/01036096/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.1) • Xcode at /Applications/Xcode14.1.app/Contents/Developer • Build 14B47b • CocoaPods version 1.12.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.86.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.84.0 [✓] Connected device (3 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 31) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.4 22F66 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.112 [✓] Network resources • All expected network resources are available. • No issues found! ```
darshankawar commented 2 months ago

@SShayashi I was able to see the localized text for those options in the toolbar as below:

Screenshot 2024-03-20 at 4 00 08 PM Screenshot 2024-03-20 at 4 00 15 PM

I verified on latest master and stable by running the code sample on iOS simulator, changed language to Japanese.

Also, see this fix for your reference: https://github.com/flutter/flutter/pull/144857

SShayashi commented 2 months ago

@darshankawar Thanks for the reply, I tried it with 3.19.2 and confirmed that it localizes correctly.

click to expand ``` fvm flutter doctor -v [!] Flutter (Channel stable, 3.19.2, on macOS 13.4 22F66 darwin-arm64, locale ja-JP) • Flutter version 3.19.2 on channel stable at /Users/01036096/fvm/versions/3.19.2 ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.19.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/01036096/fvm/versions/3.19.2. Consider adding /Users/01036096/fvm/versions/3.19.2/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 7482962148 (3 weeks ago), 2024-02-27 16:51:22 -0500 • Engine revision 04817c99c9 • Dart version 3.3.0 • DevTools version 2.31.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/01036096/Library/Android/sdk • Platform android-33, build-tools 33.0.2 • ANDROID_HOME = /Users/01036096/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [!] Xcode - develop for iOS and macOS (Xcode 14.1) • Xcode at /Applications/Xcode14.1.app/Contents/Developer • Build 14B47b ! CocoaPods 1.12.1 out of date (1.13.0 is recommended). CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions. [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.87.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.84.0 [✓] Connected device (3 available) • iPhone 14 (mobile) • 2DAB222C-752B-4291-9758-B9D95D5698ED • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.4 22F66 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.58 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 2 categories. ```
github-actions[bot] commented 1 month ago

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 flutter doctor -v and a minimal reproduction of the issue.