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 49fe91c commit 473f677
Show file tree
Hide file tree
Showing 31 changed files with 688 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

潍坊公交

使用 [Flutter](https://flutter.dev/) 编写,船新的版本,熟悉的味道,欢迎使用.
使用 [Flutter](https://flutter.dev/) 编写,船新的版本,熟悉的味道,欢迎食用.

## 致谢
[![JetBrains](jetbrains.svg "jetbrains-logo")](https://www.jetbrains.com/?from=weifangbus)
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<application
android:icon="@mipmap/ic_launcher"
android:label="潍坊公交"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config">
<activity
android:name=".MainActivity"
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WeiFang Bus</string>
</resources>
4 changes: 4 additions & 0 deletions android/app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">潍坊 バス</string>
</resources>
4 changes: 4 additions & 0 deletions android/app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">潍坊公交</string>
</resources>
4 changes: 4 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">潍坊公交</string>
</resources>
29 changes: 29 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
2A49C53F2551058200E54619 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2A49C5412551058200E54619 /* InfoPlist.strings */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
46D831E781A76989C104EE05 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C2A45890CB6410DFFDE09C3C /* Pods_Runner.framework */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
Expand All @@ -32,6 +33,13 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
2A49C5402551058200E54619 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
2A49C5422551079700E54619 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
2A49C5432551079700E54619 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
2A49C5442551079800E54619 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
2A49C545255107FE00E54619 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Main.strings; sourceTree = "<group>"; };
2A49C546255107FE00E54619 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
2A49C547255107FF00E54619 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = "<group>"; };
2A64BF0C22705C2200EA8808 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
38F4552A3BF6B20875A5290F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -130,6 +138,7 @@
97C146F11CF9000F007C117D /* Supporting Files */ = {
isa = PBXGroup;
children = (
2A49C5412551058200E54619 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -187,6 +196,8 @@
knownRegions = (
en,
Base,
"zh-Hans",
ja,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
Expand All @@ -207,6 +218,7 @@
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
2A49C53F2551058200E54619 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -322,10 +334,22 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
2A49C5412551058200E54619 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
2A49C5402551058200E54619 /* en */,
2A49C5442551079800E54619 /* zh-Hans */,
2A49C547255107FF00E54619 /* ja */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
2A49C5422551079700E54619 /* zh-Hans */,
2A49C545255107FE00E54619 /* ja */,
);
name = Main.storyboard;
sourceTree = "<group>";
Expand All @@ -334,6 +358,8 @@
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
2A49C5432551079700E54619 /* zh-Hans */,
2A49C546255107FE00E54619 /* ja */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
Expand All @@ -345,6 +371,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -422,6 +449,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -477,6 +505,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down
14 changes: 8 additions & 6 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<string>zh_CN</string>
<key>CFBundleDisplayName</key>
<string>潍坊公交</string>
<key>CFBundleExecutable</key>
Expand All @@ -22,8 +22,15 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSHasLocalizedDisplayName</key>
<true/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand All @@ -41,10 +48,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
8 changes: 8 additions & 0 deletions ios/Runner/en.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
InfoPlist.strings
Runner

Created by 韩塞 on 2020/11/3.
Copyright © 2020 The Chromium Authors. All rights reserved.
*/
"CFBundleDisplayName" = "WeiFang Bus";
8 changes: 8 additions & 0 deletions ios/Runner/ja.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
InfoPlist.strings
Runner

Created by 韩塞 on 2020/11/3.
Copyright © 2020 The Chromium Authors. All rights reserved.
*/
"CFBundleDisplayName" = "潍坊 バス";
1 change: 1 addition & 0 deletions ios/Runner/ja.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/ja.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

8 changes: 8 additions & 0 deletions ios/Runner/zh-Hans.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
InfoPlist.strings
Runner

Created by 韩塞 on 2020/11/3.
Copyright © 2020 The Chromium Authors. All rights reserved.
*/
"CFBundleDisplayName" = "潍坊公交";
1 change: 1 addition & 0 deletions ios/Runner/zh-Hans.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/zh-Hans.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

71 changes: 71 additions & 0 deletions lib/generated/intl/messages_all.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that looks up messages for specific locales by
// delegating to the appropriate library.

// Ignore issues from commonly used lints in this file.
// ignore_for_file:implementation_imports, file_names, unnecessary_new
// ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering
// ignore_for_file:argument_type_not_assignable, invalid_assignment
// ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases
// ignore_for_file:comment_references

import 'dart:async';

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';

import 'messages_en.dart' as messages_en;
import 'messages_ja.dart' as messages_ja;
import 'messages_zh.dart' as messages_zh;

typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new Future.value(null),
'ja': () => new Future.value(null),
'zh': () => new Future.value(null),
};

MessageLookupByLibrary _findExact(String localeName) {
switch (localeName) {
case 'en':
return messages_en.messages;
case 'ja':
return messages_ja.messages;
case 'zh':
return messages_zh.messages;
default:
return null;
}
}

/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async {
var availableLocale = Intl.verifiedLocale(
localeName,
(locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new Future.value(false);
}
var lib = _deferredLibraries[availableLocale];
await (lib == null ? new Future.value(false) : lib());
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new Future.value(true);
}

bool _messagesExistFor(String locale) {
try {
return _findExact(locale) != null;
} catch (e) {
return false;
}
}

MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
onFailure: (_) => null);
if (actualLocale == null) return null;
return _findExact(actualLocale);
}
30 changes: 30 additions & 0 deletions lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a en locale. All the
// messages from the main program should be duplicated here with the same
// function name.

// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';

final messages = new MessageLookup();

typedef String MessageIfAbsent(String messageStr, List<dynamic> args);

class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';

final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"AppName" : MessageLookupByLibrary.simpleMessage("WeiFang Bus"),
"Home" : MessageLookupByLibrary.simpleMessage("Home"),
"LanguageSettings" : MessageLookupByLibrary.simpleMessage("Language Settings"),
"More" : MessageLookupByLibrary.simpleMessage("More"),
"Settings" : MessageLookupByLibrary.simpleMessage("Settings")
};
}
30 changes: 30 additions & 0 deletions lib/generated/intl/messages_ja.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a ja locale. All the
// messages from the main program should be duplicated here with the same
// function name.

// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';

final messages = new MessageLookup();

typedef String MessageIfAbsent(String messageStr, List<dynamic> args);

class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'ja';

final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"AppName" : MessageLookupByLibrary.simpleMessage("潍坊 バス"),
"Home" : MessageLookupByLibrary.simpleMessage("ホーム"),
"LanguageSettings" : MessageLookupByLibrary.simpleMessage("言語設定"),
"More" : MessageLookupByLibrary.simpleMessage("もっと"),
"Settings" : MessageLookupByLibrary.simpleMessage("セットアップ")
};
}
30 changes: 30 additions & 0 deletions lib/generated/intl/messages_zh.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
// This is a library that provides messages for a zh locale. All the
// messages from the main program should be duplicated here with the same
// function name.

// Ignore issues from commonly used lints in this file.
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';

final messages = new MessageLookup();

typedef String MessageIfAbsent(String messageStr, List<dynamic> args);

class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'zh';

final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"AppName" : MessageLookupByLibrary.simpleMessage("潍坊公交"),
"Home" : MessageLookupByLibrary.simpleMessage("首页"),
"LanguageSettings" : MessageLookupByLibrary.simpleMessage("语言设置"),
"More" : MessageLookupByLibrary.simpleMessage("更多"),
"Settings" : MessageLookupByLibrary.simpleMessage("设置")
};
}
Loading

0 comments on commit 473f677

Please sign in to comment.