文档章节

flutter国际化

一个yuanbeth
 一个yuanbeth
发布于 2019/12/10 13:48
字数 1217
阅读 20
收藏 0

一、加入依赖

flutter_i18n:  ^0.8.2
flutter_localizations:
    sdk: flutter

二、引用

{
    "appName": "EasyRefresh",
    "sample": "Sample",
    "style": "Style",
    "more": "More",
    "basicUse": "BasicUse",
    "basicUseDescribe": "Basic use of EasyRefresh",
    "manualControl": "Manual control",
    "manualControlDescribe": "Control the timing of completion of refresh and load",
    "refresh": "Refresh",
    "loadMore": "LoadMore",
    "pullToRefresh": "Pull to refresh",
    "releaseToRefresh": "Release to refresh",
    "refreshing": "Refreshing...",
    "refreshFinish": "Refresh completed",
    "refreshFailed": "Refresh failed",
    "refreshed": "Refresh completed",
    "pushToLoad": "Pull to load",
    "releaseToLoad": "Release to load",
    "loading": "Loading...",
    "loadFinish": "Load completed",
    "loaded": "Load completed",
    "loadFailed": "Load failed",
    "completeRefresh": "Refresh done",
    "completeLoad": "Load done",
    "noMore": "No more",
    "updateAt": "Update at %T",
    "autoLoad": "Auto load",
    "autoLoadDescribe": "Automatically refresh the slide to the bottom",
    "floatView": "Floating view",
    "floatViewDescribe": "At the top or bottom view floating on the list",
    "userProfile": "User Profile",
    "userProfileDescribe": "User Profile with the springback effect",
    "customScrollViewDescribe": "List with AppBar Folding, listener example",
    "swiperDescribe": "Swiper example, resolve sliding conflicts",
    "listEmbed": "List embed",
    "listEmbedDescribe": "Use the connector to set the Header and Footer positions",
    "cupertinoDescribe": "ios style",
    "firstRefresh": "First refresh",
    "firstRefreshDescribe": "First refresh widget",
    "emptyWidget": "Empty widget",
    "emptyWidgetDescribe": "Show empty widget when there is no data",
    "tabViewWidgetDescribe": "List and Grid consist of TabBarView",
    "nestedScrollViewDescribe": "NestedScrollView example",
    "secondFloor": "Second floor",
    "secondFloorDescribe": "Imitate the second floor of Taobao",
    "welcomeToSecondFloor": "Welcome to second floor",
    "scrollBar": "ScrollBar",
    "scrollBarDescribe": "Add a scroll bar to the list",
    "qqGroup": "QQ group",
    "github": "Github",
    "name": "Name",
    "old": "Old",
    "noBald": "Has not the bald",
    "city": "City",
    "hangzhou": "China - HangZhou",
    "chengdu": "China - ChengDu",
    "phone": "Phone",
    "email": "E-Mail",
    "classic": "Classic",
    "classicDescribe": "Classic and default",
    "materialDescribe": "Material design, Android style",
    "ballPulseDescribe": "Ball pulse style",
    "bezierCircleDescribe": "Popup circle style",
    "bezierHourGlassDescribe": "Popup HourGlass style",
    "phoenixDescribe": "Golden campus",
    "taurusDescribe": "Rushing into the sky",
    "spaceDescribe": "Flare animation - Space",
    "deliveryDescribe": "Express balloon",
    "moreStyle": "More style",
    "moreStyleDescribe": "Come soon! You can also refer to the source code customization",
    "joinDiscussion": "Join the discussion",
    "joinDiscussionDescribe": "Join the QQ group 554981921",
    "projectAddress": "Project address",
    "supportAuthor": "Support the author",
    "supportAuthorDescribe": "Your support is my biggest motivation",
    "about": "About",
    "star": "Star project",
    "aliPay": "AliPay",
    "weiXinPay": "WeiXin Pay",
    "qqPay": "QQ Pay",
    "payPal": "PayPal",
    "noData": "No data",
    "direction": "Direction",
    "listDirection": "List direction",
    "vertical": "Vertical",
    "horizontal": "Horizontal",
    "reverse": "reverse",
    "listReverse": "List reverse",
    "infiniteLoad": "Infinite load",
    "infiniteLoadDescribe": "Slide to bottom trigger loading",
    "controlFinish": "Control finish",
    "controlFinishDescribe": "Using Controller to End Asynchronous Tasks",
    "taskIndependence": "Task independence",
    "taskIndependenceDescribe": "Refresh and load tasks are not affected by each other",
    "headerFloat": "Header float",
    "headerFloatDescribe": "Header is displayed on the list",
    "vibration": "vibration",
    "vibrationDescribe": "Triggered vibration feedback",
    "refreshSwitch": "Refresh switch",
    "refreshSwitchDescribe": "Whether to turn on refresh",
    "loadSwitch": "Load switch",
    "loadSwitchDescribe": "Whether to turn on load",
    "linkHeader": "Header linker",
    "linkHeaderDescribeDescribe": "Customize Header with linker",
    "topBouncing": "Top bouncing",
    "topBouncingDescribe": "Top can be crossed",
    "bottomBouncing": "Bottom bouncing",
    "bottomBouncingDescribe": "Bottom can be crossed",
    "chatPage": "Chat page",
    "chatPageDescribe": "Chat page example",
    "send": "Send",
    "me": "Me",
    "bobMinion": "Bob minion",
    "bobMinionDescribe": "Cute yellow Minions"
  }
{
    "appName": "EasyRefresh",
    "sample": "示例",
    "style": "样式",
    "more": "更多",
    "basicUse": "基本使用",
    "basicUseDescribe": "EasyRefresh的基本使用",
    "manualControl": "手动控制",
    "manualControlDescribe": "控制刷新和加载的完成时机",
    "refresh": "刷新",
    "loadMore": "加载",
    "pullToRefresh": "拉动刷新",
    "releaseToRefresh": "释放刷新",
    "refreshing": "正在刷新...",
    "refreshFinish": "刷新完成",
    "refreshFailed": "刷新失败",
    "refreshed": "刷新完成",
    "pushToLoad": "拉动加载",
    "releaseToLoad": "释放加载",
    "loading": "正在加载...",
    "loadFinish": "加载完成",
    "loadFailed": "加载失败",
    "loaded": "加载完成",
    "noMore": "没有更多数据",
    "completeRefresh": "完成刷新",
    "completeLoad": "完成加载",
    "updateAt": "更新于 %T",
    "autoLoad": "自动加载",
    "autoLoadDescribe": "滑到底部自动刷新",
    "floatView": "浮动视图",
    "floatViewDescribe": "顶部或底部视图浮动在列表上",
    "userProfile": "个人中心",
    "userProfileDescribe": "带回弹效果的个人中心",
    "customScrollViewDescribe": "带头部折叠的列表,监听器示例",
    "swiperDescribe": "Swiper示例,解决滑动冲突",
    "listEmbed": "列表嵌入",
    "listEmbedDescribe": "使用连接器设置Header和Footer位置",
    "cupertinoDescribe": "ios风格",
    "firstRefresh": "首次刷新",
    "firstRefreshDescribe": "首次刷新视图",
    "emptyWidget": "空视图",
    "emptyWidgetDescribe": "没有数据时显示空视图",
    "tabViewWidgetDescribe": "List和Grid组成的TabBarView",
    "nestedScrollViewDescribe": "NestedScrollView示例",
    "secondFloor": "二楼",
    "secondFloorDescribe": "模仿淘宝二楼",
    "welcomeToSecondFloor": "欢迎来到二楼",
    "scrollBar": "滚动条",
    "scrollBarDescribe": "为列表添加滚动条",
    "qqGroup": "QQ群",
    "github": "Github",
    "name": "名字",
    "old": "年龄",
    "noBald": "没到秃头的年龄",
    "city": "城市",
    "hangzhou": "中国 - 杭州",
    "chengdu": "中国 - 成都",
    "phone": "电话",
    "email": "邮箱",
    "classic": "经典样式",
    "classicDescribe": "经典(默认)风格",
    "materialDescribe": "质感设计,Android样式",
    "ballPulseDescribe": "球脉冲样式",
    "bezierCircleDescribe": "弹出圆圈",
    "bezierHourGlassDescribe": "弹出HourGlass",
    "phoenixDescribe": "金色校园",
    "taurusDescribe": "冲上云霄",
    "spaceDescribe": "Flare动画 - 星空",
    "deliveryDescribe": "气球快递",
    "moreStyle": "更多样式",
    "moreStyleDescribe": "会越来越多哦!你也可以参考源码自定义",
    "joinDiscussion": "加入讨论",
    "joinDiscussionDescribe": "加入QQ群554981921,进行讨论",
    "projectAddress": "项目地址",
    "supportAuthor": "支持作者",
    "supportAuthorDescribe": "你的支持是我最大的动力",
    "about": "关于",
    "star": "Star 项目",
    "aliPay": "支付宝",
    "weiXinPay": "微信钱包",
    "qqPay": "QQ钱包",
    "payPal": "PayPal",
    "noData": "没有数据",
    "direction": "方向",
    "listDirection": "列表方向",
    "vertical": "垂直",
    "horizontal": "水平",
    "reverse": "反向",
    "listReverse": "列表反向",
    "infiniteLoad": "无限加载",
    "infiniteLoadDescribe": "滑动到底部自动触发加载",
    "controlFinish": "控制结束",
    "controlFinishDescribe": "使用控制器结束异步任务",
    "taskIndependence": "任务独立",
    "taskIndependenceDescribe": "刷新和加载任务互不受影响(不推荐)",
    "headerFloat": "Header浮动",
    "headerFloatDescribe": "Header显示在列表之上",
    "vibration": "震动",
    "vibrationDescribe": "触发震动反馈",
    "refreshSwitch": "刷新开关",
    "refreshSwitchDescribe": "是否开启刷新",
    "loadSwitch": "加载开关",
    "loadSwitchDescribe": "是否开启加载",
    "linkHeader": "Header连接器",
    "linkHeaderDescribeDescribe": "使用连接器自定义Header",
    "topBouncing": "顶部回弹",
    "topBouncingDescribe": "顶部可越界",
    "bottomBouncing": "底部回弹",
    "bottomBouncingDescribe": "底部可越界",
    "chatPage": "聊天页面",
    "chatPageDescribe": "模仿聊天页面",
    "send": "发送",
    "me": "我",
    "bobMinion": "Bob小黄人",
    "bobMinionDescribe": "可爱的小黄人"
  }

三、在pubspec.yaml中声明

- assets/locale/

四、在main.dart的build方法中设置代理

import 'package:flutter_i18n/flutter_i18n_delegate.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
        localizationsDelegates: [
          FlutterI18nDelegate(
              useCountryCode: true,
              fallbackFile: 'zh_CN',
              path: 'assets/locale'),
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate
        ],
        localeResolutionCallback: (local, supportedLocales) {
          return local;
        }

五、使用

import 'package:flutter_i18n/flutter_i18n.dart';
loadingText: FlutterI18n.translate(context, 'loading'),

参考:

https://github.com/xuelongqy/flutter_easyrefresh/blob/v2/example/lib/page/sample/basic.dart

© 著作权归作者所有

一个yuanbeth
粉丝 104
博文 163
码字总数 87829
作品 0
深圳
程序员
私信 提问
Android 程序员入坑 Flutter

一、前言 闲来无事,花了两个多星期入了的坑,总结了一下这段时间学到的东西以及学习过程中看过的资料,也是想看看自己有哪些遗漏的地方,感谢网上的各位大神。 框架搭好了,之后也会根据总结...

泽毛
2019/07/08
0
0
StudyFlutter——我的第一个APP

一个菜鸟的第一个 APP,本文大部分设计摘抄自一周时间编写你的第二个 Flutter APP.由于对于和缺乏基本的熟悉,基本上算是以实战来作为学习方法,因此部分代码可能不是很规范,大家有发现的部...

苏灿烤鱼
2019/05/19
0
0
从零学习Fluter(五):Flutter中手势滑动拖动已经网络请求

从六号开始搞Flutter,到今天写这篇blog已经过了4天时间,文档初步浏览了一遍,写下了这个demo。demo源码分享在github上,现在对flutter有种说不出的喜欢了。大家一起搞吧! 废话不多说,开始...

topbrids
2018/12/09
0
0
从零学习Fluter(六):Flutter仿boss直聘v1.0重构

今天继续学习flutter,觉得这个优秀的东西,许多方面还需要完善,作为一个后来者,要多向别人学习。俗话说,“学无先后,达者为师”。今天呢,我又重新把flutter_boss这个项目代码 从头到脚看...

topbrids
2018/12/10
0
0
Google Flutter beta1 重磅发布,轻松开发精美原生应用

在 2018 世界移动大会上,Google 发布了 Flutter 的首个 beta 版本。 Flutter 是 Google 用以帮助开发者在 iOS 和 Android 两个平台开发高质量的原生应用的全新移动 UI 框架,帮助快速上手开...

王练
2018/02/28
5.3K
12

没有更多内容

加载失败,请刷新页面

加载更多

mysql中int(11)的列大小是多少?

mysql中int(11)的列大小是多少? 以及可以在此列中存储的最大值? #1楼 mysql中int(11)的列大小是多少? (11) int数据类型的此属性与列的大小无关。 它只是整数数据类型的显示宽度。 从11....

技术盛宴
30分钟前
37
0
聊聊artemis消息的推拉模式

序 本文主要研究一下artemis消息的推拉模式 拉模式 receive activemq-artemis-2.11.0/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.......

go4it
40分钟前
39
0
vue 全局前置守卫引起死循环的原因与解决方法

我们经常会用到全局前置守卫,如判断用户有没有登陆过,如果登陆过就直接跳到目的页面,如果没有登陆过,就跳转到登陆页。 先看官网对全局前置守卫的介绍 使用 router.beforeEach 注册一个全...

tianyawhl
51分钟前
31
0
如何按索引从std :: vector <>擦除元素?

我有一个std :: vector <int>,我想删除第n个元素。 我怎么做? std::vector<int> vec;vec.push_back(6);vec.push_back(-17);vec.push_back(12);vec.erase(???); #1楼 erase方法将以两......

javail
今天
43
0
使用生成器模拟时间分片

对于cpu密集型任务, 时间分片可以有效减少页面卡顿, 不过对于纯计算型任务还是推荐使用worker在后台做计算 效果图, 计算密集型任务被分到每次只执行16ms, 每次执行完毕留给浏览器时间去响应事...

阿豪boy
今天
63
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部