当前位置:网站首页>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.
边栏推荐
- Seata数据库中出现以下问题要怎么解决啊?
- 3. caller service call - dapr
- R language ggplot2 visualization: use the patchwork package to horizontally form two ggplot2 visualization results into a new result visualization combination diagram (using the | symbol)
- Experiment 6 8255 parallel interface experiment [microcomputer principle] [experiment]
- R language ggplot2 visualization: the patchwork package horizontally combines a ggplot2 visualization result and a plot function visualization result to form a final result graph, aligns the two visua
- Does Frankfurt currently support SQL?
- 坐拥1200亿,她又要IPO敲钟了
- ROS知识点——ROS创建工作空间
- Longest continuous sequence
- Facebook! Adaptive gradient defeats manual parameter adjustment
猜你喜欢
随机推荐
R language ggplot2 visualization: the patchwork package is used to customize and combine the three ggplot2 visualization results to form a composite graph. After the horizontal combination of two sub
Fleet |「後臺探秘」第 3 期:狀態管理
Jackie Chan and fast brand, who is the Savior of Kwai?
Le patron a donné trois ordres: discret, discret, discret
Seata数据库中出现以下问题要怎么解决啊?
Fleet |「后台探秘」第 3 期:状态管理
What are the benefits of this PMP certificate?
教育行业SaaS应用管理平台解决方案:助力企业实现经营、管理一体化
从莫高窟到太平洋,海量数据找到了新家园
Technical trendsetter
如何从零搭建10万级 QPS 大流量、高并发优惠券系统
The best time to buy and sell stocks
成龙和快品牌,谁才是快手的救星?
当下不做元宇宙,就像20年前没买房!
GCC efficient graph revolution for joint node representationlearning and clustering
ROS knowledge points - definition and use of topic messages
C语言学习-20-归并排序
Cross cluster deployment of helm applications using karmada
Is PMP really useful?
[JS] Fibonacci sequence implementation (recursion and loop)








