Skip to content

Commit

Permalink
update localizations
Browse files Browse the repository at this point in the history
  • Loading branch information
yang991178 committed Feb 2, 2021
1 parent ab36f0e commit 35bca6d
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 10 deletions.
3 changes: 3 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
/* 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>"; };
324ACECE25C909AD00CD3591 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
32561D9E25BE823400DBD252 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
3271990C25BBF9C8008EA00E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; 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 @@ -175,6 +176,7 @@
en,
Base,
"zh-Hans",
es,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
Expand Down Expand Up @@ -296,6 +298,7 @@
children = (
97C147001CF9000F007C117D /* Base */,
3271990C25BBF9C8008EA00E /* zh-Hans */,
324ACECE25C909AD00CD3591 /* es */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
Expand Down
1 change: 1 addition & 0 deletions ios/Runner/es.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

5 changes: 4 additions & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"allArticles": "All Articles",
"all": "All Articles",
"unread": "Unread",
"starred": "Starred",
"allArticles": "All articles",
"allSubscriptions": "All subscriptions",
"filter": "Filter",
"feed": "Feed",
Expand Down
5 changes: 4 additions & 1 deletion lib/l10n/intl_es.arb
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"all": "Todos",
"unread": "Sin leídos",
"starred": "Favoritos",
"allArticles": "Todos los artículos",
"allSubscriptions": "Todas las suscripciones",
"filter": "Filtrar",
"feed": "Alimentador",
"feed": "Artículos",
"subscriptions": "Suscriptores",
"groups": "Grupos",
"settings": "Ajustes",
Expand Down
3 changes: 3 additions & 0 deletions lib/l10n/intl_zh.arb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"all": "全部文章",
"unread": "未读文章",
"starred": "星标文章",
"allArticles": "全部文章",
"allSubscriptions": "全部订阅源",
"filter": "筛选",
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class MyApp extends StatelessWidget {
locale: globalModel.locale,
supportedLocales: [
const Locale("en"),
const Locale("es"),
const Locale("zh"),
],
localeResolutionCallback: (_locale, supportedLocales) {
Expand Down
22 changes: 20 additions & 2 deletions lib/pages/item_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,24 @@ class _ItemListPageState extends State<ItemListPage> {
);
}

Widget _titleFromFilter() => Consumer<FeedsModel>(
builder: (context, feedsModel, child) {
String text;
switch (getFeed().filterType) {
case FilterType.Unread:
text = S.of(context).unread;
break;
case FilterType.Starred:
text = S.of(context).starred;
break;
default:
text = S.of(context).all;
break;
}
return Text(text, overflow: TextOverflow.ellipsis);
},
);

@override
Widget build(BuildContext context) {
final String title = ModalRoute.of(context).settings.arguments;
Expand All @@ -275,8 +293,8 @@ class _ItemListPageState extends State<ItemListPage> {
? 260
: MediaQuery.of(context).size.width - 60,
),
child: Text(
title ?? S.of(context).allArticles,
child: title == null ? _titleFromFilter() : Text(
title,
overflow: TextOverflow.ellipsis,
),
),
Expand Down
5 changes: 3 additions & 2 deletions lib/pages/settings/general_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ class _GeneralPageState extends State<GeneralPage> {
final localeItems = ListTileGroup.fromOptions(
[
Tuple2(S.of(context).followSystem, null),
Tuple2("English", Locale("en")),
Tuple2("中文(简体)", Locale("zh")),
const Tuple2("English", Locale("en")),
const Tuple2("Español", Locale("es")),
const Tuple2("中文(简体)", Locale("zh")),
],
globalModel.locale,
(l) { globalModel.locale = l; },
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/subscription_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:fluent_reader_lite/pages/group_list_page.dart';
import 'package:fluent_reader_lite/pages/home_page.dart';
import 'package:fluent_reader_lite/utils/colors.dart';
import 'package:fluent_reader_lite/utils/global.dart';
import 'package:fluent_reader_lite/utils/store.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand All @@ -33,7 +34,7 @@ class _SubscriptionListPageState extends State<SubscriptionListPage> {
List<String> sids;
String title;
bool transitioning = false;
bool unreadOnly = false;
bool unreadOnly = Store.sp.getBool(StoreKeys.UNREAD_SUBS_ONLY) ?? false;

void _onScrollTop() {
if (widget.scrollTopNotifier.index == 1 && !Navigator.of(context).canPop()) {
Expand Down Expand Up @@ -117,6 +118,7 @@ class _SubscriptionListPageState extends State<SubscriptionListPage> {
HapticFeedback.mediumImpact();
setState(() { unreadOnly = !unreadOnly; });
_onScrollTop();
Store.sp.setBool(StoreKeys.UNREAD_SUBS_ONLY, unreadOnly);
}

void _dismissTip() {
Expand Down Expand Up @@ -295,7 +297,7 @@ class _SubscriptionListPageState extends State<SubscriptionListPage> {
navigationBar,
SyncControl(),
if (Global.sourcesModel.showUnreadTip) _buildUnreadTip(),
if (sids != null) Consumer<SourcesModel>(
if (sids != null && sids.length > 0) Consumer<SourcesModel>(
builder: (context, sourcesModel, child) {
var count = sids
.map((sid) => sourcesModel.getSource(sid))
Expand Down
1 change: 1 addition & 0 deletions lib/utils/store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ abstract class StoreKeys {
static const GROUPS = "groups";
static const ERROR_LOG = "errorLog";
static const UNCATEGORIZED = "uncategorized";
static const UNREAD_SUBS_ONLY = "unreadSubsOnly";

// General
static const THEME = "theme";
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract class Utils {
}

static final _urlRegex = RegExp(
r"^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*$)",
r"^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,63}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*$)",
caseSensitive: false,
);
static bool testUrl(String url) => url != null && _urlRegex.hasMatch(url.trim());
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.1+5
version: 1.0.1+6

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit 35bca6d

Please sign in to comment.