flutter - How to change language of system clipboard text (Copy, Paste etc.,) to Chinese in Flutter?
问题描述
I tried this, but it does not seem to work:
new MaterialApp(
title: 'Mian',
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('zh','HK')
],
I want to change the Paste to 粘贴,Select All to 选择全部
解决方案
- add
flutter_localizations
intopubspec.yaml
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
- import
flutter_localizations
intomain.dart
import 'package:flutter_localizations/flutter_localizations.dart';
- use
supportedLocales
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter',
home: new HomePage(title: ''),
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
DefaultCupertinoLocalizations.delegate
],
supportedLocales: [
const Locale('zh','CH'),
],
);
}
}
推荐阅读
- c# - 如何将 .NET 框架中的 gRPC 客户端与安全的 .NET Core 服务器连接起来?
- r - 为什么 R 找不到与主包位于同一本地文件夹中的依赖项?
- ios - 从 iOS 中的 C 函数中使用 Swift 入口点生成线程
- java - JFRAME, MouseListener 画一个圆
- python - Lasso 中的均方误差 (MSE) 和 Python 中的岭回归
- javascript - 如何使用 JavaScript 继承父元素的 CSS 属性?
- python - Scipy错误不等式约束不兼容(退出模式4)
- vue.js - Vuex - 在 created() 中调度的操作在重新加载窗口之前不会运行?
- prometheus - Istio - 如何添加自定义的基于标签的指标?
- go - 如何使用 golang 客户端从 Kubernetes 中驱逐或删除 Pod