当前位置:网站首页>Flutter简单实现多语言国际化
Flutter简单实现多语言国际化
2022-06-28 15:14:00 【明似水】
前言
最近做国外项目,那么国际化当然不可以避免啦,下面介绍一下国际化如何简单实现。
一、引入插件
flutter_localizations:
sdk: flutter

二、加入intl工具

点击initialize for the project后生成如下目录:
也可以点击Add Locale添加其他语言。
三、在main文件里配置

localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [...S.delegate.supportedLocales],
locale: const Locale('zh', 'TW'),
这样就简单加入了国际化配置。
四、使用
选中你要国际化的文字,按住option + 回车键,会弹窗如下:
选中Extract to ARB file
然后在String key写上你的命名,然后OK就自动生成对应的key。如图所示:
END.
边栏推荐
- SAP mts/ato/mto/eto topic 9: front and back desk operation in m+m mode, strategy 50, preparation of raw materials and semi-finished products in advance
- 一个bug肝一周...忍不住提了issue
- Vector explanation + topic
- High "green premium" of environmental protection products? How far is the low-carbon lifestyle from people
- WPF 视频硬解码渲染播放(无空域)(支持4K、8K、高帧率视频)
- R language ggplot2 visualization: use the patchwork package (directly use the plus sign +) to horizontally combine a ggplot2 visualization result and a data table to form a final result graph
- 力扣今日题-522. 最长特殊序列
- [C language] how to implement plural types
- 石油化工行业供应链系统驱动管理模式创新升级,强化企业内部管理
- Could you tell me whether the batch addition of Oracle such as insert all was not blocked?
猜你喜欢

PostgreSQL 存储结构浅析

币圈大地震:去年赚100万,今年亏500万

GBASE南大通用亮相第六届世界智能大会

C语言学习-20-归并排序
Technical trendsetter

教育行业SaaS应用管理平台解决方案:助力企业实现经营、管理一体化

S2b2c system website solution for kitchen and bathroom electrical appliance industry: create s2b2c platform Omni channel commercial system

Complete model training routine (I)

Performance comparison of deep learning models on cat and dog image data sets

Le patron a donné trois ordres: discret, discret, discret
随机推荐
论文解读(GCC)《Efficient Graph Convolution for Joint Node RepresentationLearning and Clustering》
Gbase Nantah General Motors appears at the 6th World Intelligence Conference
SQL statement exercises
Leetcode 48. Rotate image (yes, resolved)
厨卫电器行业S2B2C系统网站解决方案:打造S2B2C平台全渠道商业系统
使用Karmada实现Helm应用的跨集群部署
化学制品制造业智慧供应商管理系统深度挖掘供应商管理领域,提升供应链协同
go-zero 微服务实战系列(七、请求量这么高该如何优化)
Calculator (force buckle)
Steve Jobs of the United States, died; China jobs, sold
环保产品“绿色溢价”高?低碳生活方式离人们还有多远
GBASE南大通用亮相第六届世界智能大会
The boss told me three times: low key, low key, low key
鸟类飞行状态下穿戴式神经信号与行为数据检测记录系统的技术难点总结
老板囑咐了三遍:低調、低調、低調
WPF 视频硬解码渲染播放(无空域)(支持4K、8K、高帧率视频)
R language ggplot2 visualization: use the patchwork package to stack two ggplot2 visualization results vertically to form a composite diagram, and stack one visualization result on the other visualiza
ROS知识点——话题消息的定义与使用
笔试面试算法经典–最长回文子串
SAP mts/ato/mto/eto topic 9: front and back desk operation in m+m mode, strategy 50, preparation of raw materials and semi-finished products in advance