Skip to content

Commit

Permalink
需要翻译的有些多,慢慢来吧.先这样
Browse files Browse the repository at this point in the history
  • Loading branch information
imhansai committed Nov 3, 2020
1 parent 473f677 commit d18ffe5
Show file tree
Hide file tree
Showing 16 changed files with 165 additions and 45 deletions.
8 changes: 8 additions & 0 deletions lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"AppName" : MessageLookupByLibrary.simpleMessage("WeiFang Bus"),
"ExitApp" : MessageLookupByLibrary.simpleMessage("click again to exit the application"),
"Explore" : MessageLookupByLibrary.simpleMessage("Explore"),
"Guide" : MessageLookupByLibrary.simpleMessage("Guide"),
"Home" : MessageLookupByLibrary.simpleMessage("Home"),
"LanguageSettings" : MessageLookupByLibrary.simpleMessage("Language Settings"),
"More" : MessageLookupByLibrary.simpleMessage("More"),
"News" : MessageLookupByLibrary.simpleMessage("News"),
"NoNews" : MessageLookupByLibrary.simpleMessage("No News"),
"NoPictures" : MessageLookupByLibrary.simpleMessage("No Pictures"),
"RouteQuery" : MessageLookupByLibrary.simpleMessage("Route Query"),
"SearchLine" : MessageLookupByLibrary.simpleMessage("Search Line"),
"Settings" : MessageLookupByLibrary.simpleMessage("Settings")
};
}
8 changes: 8 additions & 0 deletions lib/generated/intl/messages_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"AppName" : MessageLookupByLibrary.simpleMessage("潍坊 バス"),
"ExitApp" : MessageLookupByLibrary.simpleMessage("もう一度クリックしてアプリを終了します"),
"Explore" : MessageLookupByLibrary.simpleMessage("見る"),
"Guide" : MessageLookupByLibrary.simpleMessage("ガイド"),
"Home" : MessageLookupByLibrary.simpleMessage("ホーム"),
"LanguageSettings" : MessageLookupByLibrary.simpleMessage("言語設定"),
"More" : MessageLookupByLibrary.simpleMessage("もっと"),
"News" : MessageLookupByLibrary.simpleMessage("ニュース"),
"NoNews" : MessageLookupByLibrary.simpleMessage("情報はまだありません"),
"NoPictures" : MessageLookupByLibrary.simpleMessage("写真はしばらくありません"),
"RouteQuery" : MessageLookupByLibrary.simpleMessage("ルートクエリ"),
"SearchLine" : MessageLookupByLibrary.simpleMessage("経路を探索する"),
"Settings" : MessageLookupByLibrary.simpleMessage("セットアップ")
};
}
8 changes: 8 additions & 0 deletions lib/generated/intl/messages_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"AppName" : MessageLookupByLibrary.simpleMessage("潍坊公交"),
"ExitApp" : MessageLookupByLibrary.simpleMessage("再次点击退出应用"),
"Explore" : MessageLookupByLibrary.simpleMessage("探索"),
"Guide" : MessageLookupByLibrary.simpleMessage("导 乘"),
"Home" : MessageLookupByLibrary.simpleMessage("首页"),
"LanguageSettings" : MessageLookupByLibrary.simpleMessage("语言设置"),
"More" : MessageLookupByLibrary.simpleMessage("更多"),
"News" : MessageLookupByLibrary.simpleMessage("资 讯"),
"NoNews" : MessageLookupByLibrary.simpleMessage("暂无资讯信息"),
"NoPictures" : MessageLookupByLibrary.simpleMessage("暂无图片展示"),
"RouteQuery" : MessageLookupByLibrary.simpleMessage("线路查询"),
"SearchLine" : MessageLookupByLibrary.simpleMessage("搜索线路"),
"Settings" : MessageLookupByLibrary.simpleMessage("设置")
};
}
80 changes: 80 additions & 0 deletions lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"AppName": "WeiFang Bus",
"Home": "Home",
"Explore": "Explore",
"More": "More",
"ExitApp": "click again to exit the application",
"RouteQuery": "Route Query",
"Guide": "Guide",
"News": "News",
"NoNews": "No News",
"NoPictures": "No Pictures",
"SearchLine": "Search Line",
"Settings": "Settings",
"LanguageSettings": "Language Settings"
}
8 changes: 8 additions & 0 deletions lib/l10n/intl_ja.arb
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"AppName": "潍坊 バス",
"Home": "ホーム",
"Explore": "見る",
"More": "もっと",
"ExitApp": "もう一度クリックしてアプリを終了します",
"RouteQuery": "ルートクエリ",
"Guide": "ガイド",
"News": "ニュース",
"NoNews": "情報はまだありません",
"NoPictures": "写真はしばらくありません",
"SearchLine": "経路を探索する",
"Settings": "セットアップ",
"LanguageSettings": "言語設定"
}
8 changes: 8 additions & 0 deletions lib/l10n/intl_zh.arb
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"AppName": "潍坊公交",
"Home": "首页",
"Explore": "探索",
"More": "更多",
"ExitApp": "再次点击退出应用",
"RouteQuery": "线路查询",
"Guide": "导 乘",
"News": "资 讯",
"NoNews": "暂无资讯信息",
"NoPictures": "暂无图片展示",
"SearchLine": "搜索线路",
"Settings": "设置",
"LanguageSettings": "语言设置"
}
5 changes: 3 additions & 2 deletions lib/util/language_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ class LanguageUtil {
return str;
}

/// 展示和设置语言
/// 设置语言
static setLanguage(
BuildContext context, LanguagePreference languagePreference) {
print('语言切换至: $languagePreference');
var str = languageString(languagePreference);
print('语言切换至: $str');
switch (languagePreference) {
case LanguagePreference.auto:
context.read<LocaleProvider>().setLocale(null);
Expand Down
10 changes: 2 additions & 8 deletions lib/view/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,15 @@ class _WeiFangBusApp extends State<WeiFangBusApp> {
Locale _locale;

/// 获取选择的外观
_getAppearance() async {
_getAppearanceAndLanguage() async {
var appearance = await AppearanceUtil.getAppearance();
print('appearance: $appearance');
var languagePreference = await LanguageUtil.getLanguagePreference();
print('languagePreference: $languagePreference');
var locale = LanguageUtil.getLocale(languagePreference);
print('locale: $locale _locale: $_locale');
setState(() {
print('app 设置语言');
_locale = locale;
});
if (appearance != null && _appearance != appearance) {
setState(() {
print('app 设置外观');
_appearance = appearance;
});
}
Expand All @@ -65,12 +60,11 @@ class _WeiFangBusApp extends State<WeiFangBusApp> {
super.initState();
// 强制竖屏
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
_getAppearance();
_getAppearanceAndLanguage();
}

@override
Widget build(BuildContext context) {
print('app 开始构建');
return MultiProvider(
providers: [
// 资讯信息
Expand Down
4 changes: 2 additions & 2 deletions lib/view/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
),
BottomNavigationBarItem(
icon: Icon(Icons.explore),
label: '发现',
label: S.of(context).Explore,
),
BottomNavigationBarItem(
icon: Icon(Icons.more_vert),
Expand Down Expand Up @@ -95,7 +95,7 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
_homeKey.currentState.showSnackBar(
SnackBar(
content: Text(
'再次点击退出应用',
S.of(context).ExitApp,
textAlign: TextAlign.center,
),
duration: Duration(milliseconds: 1500),
Expand Down
Loading

0 comments on commit d18ffe5

Please sign in to comment.