From 6c02bf65abedf0f2e1d9b7abeecd106e146555d0 Mon Sep 17 00:00:00 2001 From: wgh19 Date: Wed, 15 May 2024 19:33:16 +0800 Subject: [PATCH] translation --- assets/tr.json | 38 ++++++++++++++++++++++++++++++++++-- lib/appdata.dart | 2 +- lib/network/download.dart | 2 +- lib/network/models.dart | 2 +- lib/pages/ranking.dart | 2 +- lib/pages/search_page.dart | 20 +++++++++---------- lib/pages/settings_page.dart | 27 ++++++++++++++++++++----- 7 files changed, 72 insertions(+), 21 deletions(-) diff --git a/assets/tr.json b/assets/tr.json index 93dc04c..e74989a 100644 --- a/assets/tr.json +++ b/assets/tr.json @@ -89,7 +89,24 @@ "The first tag of the artwork": "作品的第一个标签", "The second tag of the artwork": "作品的第二个标签", "Follow": "关注", - "Save to": "保存到" + "Save to": "保存到", + "Filled with tags. The tags should be separated by a space. The tag in front has higher weight.": "填写标签, 标签应该用空格分隔, 前面的标签权重更高. ", + "It is required to use the original name instead of the translated name.": "必须使用原始名称而不是翻译后的名称", + "Some keywords will be replaced by the following rule:": "一些关键词将按照以下规则替换:", + "Subpath": "子路径", + "Tags partial match": "标签部分匹配", + "Tags exact match": "标签完全匹配", + "Title or description search": "标题或描述搜索", + "Unlimited": "无限制", + "New to old": "新到旧", + "Old to new": "旧到新", + "Popular": "热门", + "Popular(limited)": "热门(受限)", + "Popular(Male)": "热门(男性向)", + "Popular(Female)": "热门(女性向)", + "Start Time": "开始时间", + "End Time": "结束时间", + "Max parallels": "最大并行数" }, "zh_TW": { "Search": "搜索", @@ -181,6 +198,23 @@ "The first tag of the artwork": "作品的第一個標籤", "The second tag of the artwork": "作品的第二個標籤", "Follow": "關注", - "Save to": "保存到" + "Save to": "保存到", + "Filled with tags. The tags should be separated by a space. The tag in front has higher weight.": "填寫標籤, 標籤應該用空格分隔, 前面的標籤權重更高. ", + "It is required to use the original name instead of the translated name.": "必須使用原始名稱而不是翻譯後的名稱", + "Some keywords will be replaced by the following rule:": "一些關鍵詞將按照以下規則替換:", + "Subpath": "子路徑", + "Tags partial match": "標籤部分匹配", + "Tags exact match": "標籤完全匹配", + "Title or description search": "標題或描述搜索", + "Unlimited": "無限制", + "New to old": "新到舊", + "Old to new": "舊到新", + "Popular": "熱門", + "Popular(limited)": "熱門(受限)", + "Popular(Male)": "熱門(男性)", + "Popular(Female)": "熱門(女性)", + "Start Time": "開始時間", + "End Time": "結束時間", + "Max parallels": "最大並行數" } } \ No newline at end of file diff --git a/lib/appdata.dart b/lib/appdata.dart index 76d480a..76ce75e 100644 --- a/lib/appdata.dart +++ b/lib/appdata.dart @@ -18,7 +18,7 @@ class _Appdata { "downloadSubPath": r"/${id}-p${index}.${ext}", "tagsWeight": "", "useTranslatedNameForDownload": false, - "maxDownloadParallelism": 3 + "maxDownloadParallels": 3 }; bool lock = false; diff --git a/lib/network/download.dart b/lib/network/download.dart index d888baa..4bb2824 100644 --- a/lib/network/download.dart +++ b/lib/network/download.dart @@ -263,7 +263,7 @@ class DownloadManager { _currentBytes += bytes; } - int get maxConcurrentTasks => 3; + int get maxConcurrentTasks => appdata.settings["maxDownloadParallels"]; void run() { _loop ??= Timer.periodic(const Duration(seconds: 1), (timer) { diff --git a/lib/network/models.dart b/lib/network/models.dart index 38624df..fd3cdd2 100644 --- a/lib/network/models.dart +++ b/lib/network/models.dart @@ -217,7 +217,7 @@ class TrendingTag { } enum KeywordMatchType { - tagsPartialMatches("Tags partial matches"), + tagsPartialMatches("Tags partial match"), tagsExactMatch("Tags exact match"), titleOrDescriptionSearch("Title or description search"); diff --git a/lib/pages/ranking.dart b/lib/pages/ranking.dart index 1574b5c..6a08b18 100644 --- a/lib/pages/ranking.dart +++ b/lib/pages/ranking.dart @@ -57,7 +57,7 @@ class _RankingPageState extends State { BatchDownloadButton(request: () => Network().getRanking(type)), const SizedBox(width: 8,), DropDownButton( - title: Text(types[type]!), + title: Text(types[type]!.tl), items: types.entries.map((e) => MenuFlyoutItem( text: Text(e.value.tl), onPressed: () { diff --git a/lib/pages/search_page.dart b/lib/pages/search_page.dart index ce3e35e..d94c10f 100644 --- a/lib/pages/search_page.dart +++ b/lib/pages/search_page.dart @@ -267,10 +267,10 @@ class _SearchSettingsState extends State { child: Text("Search Settings".tl, style: const TextStyle(fontSize: 18),), ).toAlign(Alignment.centerLeft), buildItem(title: "Match".tl, child: DropDownButton( - title: Text(appdata.searchOptions.matchType.toString()), + title: Text(appdata.searchOptions.matchType.toString().tl), items: KeywordMatchType.values.map((e) => MenuFlyoutItem( - text: Text(e.toString()), + text: Text(e.toString().tl), onPressed: () { if(appdata.searchOptions.matchType != e) { setState(() => appdata.searchOptions.matchType = e); @@ -281,10 +281,10 @@ class _SearchSettingsState extends State { ).toList(), )), buildItem(title: "Favorite number".tl, child: DropDownButton( - title: Text(appdata.searchOptions.favoriteNumber.toString()), + title: Text(appdata.searchOptions.favoriteNumber.toString().tl), items: FavoriteNumber.values.map((e) => MenuFlyoutItem( - text: Text(e.toString()), + text: Text(e.toString().tl), onPressed: () { if(appdata.searchOptions.favoriteNumber != e) { setState(() => appdata.searchOptions.favoriteNumber = e); @@ -295,10 +295,10 @@ class _SearchSettingsState extends State { ).toList(), )), buildItem(title: "Sort".tl, child: DropDownButton( - title: Text(appdata.searchOptions.sort.toString()), + title: Text(appdata.searchOptions.sort.toString().tl), items: SearchSort.values.map((e) => MenuFlyoutItem( - text: Text(e.toString()), + text: Text(e.toString().tl), onPressed: () { if(appdata.searchOptions.sort != e) { setState(() => appdata.searchOptions.sort = e); @@ -315,7 +315,7 @@ class _SearchSettingsState extends State { width: double.infinity, child: Column( children: [ - const Text("Start Time", style: TextStyle(fontSize: 16),) + Text("Start Time".tl, style: const TextStyle(fontSize: 16),) .paddingVertical(8) .toAlign(Alignment.centerLeft) .paddingLeft(16), @@ -339,7 +339,7 @@ class _SearchSettingsState extends State { width: double.infinity, child: Column( children: [ - const Text("End Time", style: TextStyle(fontSize: 16),) + Text("End Time".tl, style: const TextStyle(fontSize: 16),) .paddingVertical(8) .toAlign(Alignment.centerLeft) .paddingLeft(16), @@ -357,10 +357,10 @@ class _SearchSettingsState extends State { ), )), buildItem(title: "Age limit".tl, child: DropDownButton( - title: Text(appdata.searchOptions.ageLimit.toString()), + title: Text(appdata.searchOptions.ageLimit.toString().tl), items: AgeLimit.values.map((e) => MenuFlyoutItem( - text: Text(e.toString()), + text: Text(e.toString().tl), onPressed: () { if(appdata.searchOptions.ageLimit != e) { setState(() => appdata.searchOptions.ageLimit = e); diff --git a/lib/pages/settings_page.dart b/lib/pages/settings_page.dart index 129f9dd..6c34852 100644 --- a/lib/pages/settings_page.dart +++ b/lib/pages/settings_page.dart @@ -115,7 +115,7 @@ class _SettingsPageState extends State { child: Column( children: [ buildItem( - title: "Download Path", + title: "Download Path".tl, subtitle: appdata.settings["downloadPath"], action: Button( child: Text("Manage".tl).fixWidth(64), @@ -128,7 +128,7 @@ class _SettingsPageState extends State { }), ), buildItem( - title: "Subpath", + title: "Subpath".tl, subtitle: appdata.settings["downloadSubPath"], action: Button( child: Text("Manage".tl).fixWidth(64), @@ -136,6 +136,23 @@ class _SettingsPageState extends State { context.to(() => const _SetDownloadSubPathPage()); }), ), + buildItem( + title: "Max parallels".tl, + action: SizedBox( + width: 64, + height: 32, + child: NumberBox( + value: appdata.settings["maxParallels"], + autofocus: false, + onChanged: (value) { + appdata.settings["maxParallels"] = value; + appdata.writeSettings(); + }, + clearButton: false, + mode: SpinButtonPlacementMode.none, + ), + ), + ), ], ), ); @@ -289,7 +306,7 @@ class __SetDownloadSubPathPageState extends State<_SetDownloadSubPathPage> { ${"Edit the rule for where to save an image.".tl} ${"Note: The rule should include the filename.".tl} -${"Some keywords will be replaced by the following rule:"} +${"Some keywords will be replaced by the following rule:".tl} \${title} -> ${"Title of the work".tl} \${author} -> ${"Name of the author".tl} \${id} -> ${"Artwork ID".tl} @@ -303,7 +320,7 @@ ${"The final text will be affected by the \"Use translated tag name\" setting.". ... ${"Weights of the tags".tl}: -Filled with tags. The tags should be separated by a space. The tag in front has higher weight. -It is required to use the original name instead of the translated name. +${"Filled with tags. The tags should be separated by a space. The tag in front has higher weight.".tl} +${"It is required to use the original name instead of the translated name.".tl} """; }