Localized post categories

This commit is contained in:
LittleSheep 2024-12-22 15:20:33 +08:00
parent 1256f440bd
commit fd2eb5cda6
6 changed files with 90 additions and 43 deletions

View File

@ -478,5 +478,15 @@
"colorSchemeRed": "Red", "colorSchemeRed": "Red",
"colorSchemeWhite": "White", "colorSchemeWhite": "White",
"colorSchemeBlack": "Black", "colorSchemeBlack": "Black",
"colorSchemeApplied": "Color scheme has been applied, may need restart the app to take effect." "colorSchemeApplied": "Color scheme has been applied, may need restart the app to take effect.",
"postCategoryTechnology": "Technology",
"postCategoryGaming": "Gaming",
"postCategoryLife": "Life",
"postCategoryArts": "Arts",
"postCategorySports": "Sports",
"postCategoryMusic": "Music",
"postCategoryNews": "News",
"postCategoryKnowledge": "Knowledge",
"postCategoryLiterature": "Literature",
"postCategoryUncategorized": "Uncategorized"
} }

View File

@ -476,5 +476,15 @@
"colorSchemeRed": "红色", "colorSchemeRed": "红色",
"colorSchemeWhite": "白色", "colorSchemeWhite": "白色",
"colorSchemeBlack": "黑色", "colorSchemeBlack": "黑色",
"colorSchemeApplied": "主题色已应用,可能需要重启来生效。" "colorSchemeApplied": "主题色已应用,可能需要重启来生效。",
"postCategoryTechnology": "技术",
"postCategoryGaming": "游戏",
"postCategoryLife": "生活",
"postCategoryArts": "艺术",
"postCategorySports": "体育",
"postCategoryMusic": "音乐",
"postCategoryNews": "新闻",
"postCategoryKnowledge": "知识",
"postCategoryLiterature": "文学",
"postCategoryUncategorized": "未分类"
} }

View File

@ -476,5 +476,15 @@
"colorSchemeRed": "紅色", "colorSchemeRed": "紅色",
"colorSchemeWhite": "白色", "colorSchemeWhite": "白色",
"colorSchemeBlack": "黑色", "colorSchemeBlack": "黑色",
"colorSchemeApplied": "主題色已應用,可能需要重啓來生效。" "colorSchemeApplied": "主題色已應用,可能需要重啓來生效。",
"postCategoryTechnology": "技術",
"postCategoryGaming": "遊戲",
"postCategoryLife": "生活",
"postCategoryArts": "藝術",
"postCategorySports": "體育",
"postCategoryMusic": "音樂",
"postCategoryNews": "新聞",
"postCategoryKnowledge": "知識",
"postCategoryLiterature": "文學",
"postCategoryUncategorized": "未分類"
} }

View File

@ -476,5 +476,15 @@
"colorSchemeRed": "紅色", "colorSchemeRed": "紅色",
"colorSchemeWhite": "白色", "colorSchemeWhite": "白色",
"colorSchemeBlack": "黑色", "colorSchemeBlack": "黑色",
"colorSchemeApplied": "主題色已應用,可能需要重啟來生效。" "colorSchemeApplied": "主題色已應用,可能需要重啟來生效。",
"postCategoryTechnology": "技術",
"postCategoryGaming": "遊戲",
"postCategoryLife": "生活",
"postCategoryArts": "藝術",
"postCategorySports": "體育",
"postCategoryMusic": "音樂",
"postCategoryNews": "新聞",
"postCategoryKnowledge": "知識",
"postCategoryLiterature": "文學",
"postCategoryUncategorized": "未分類"
} }

View File

@ -981,7 +981,12 @@ class _PostTagsList extends StatelessWidget {
children: [ children: [
const Icon(Symbols.category, size: 20), const Icon(Symbols.category, size: 20),
const Gap(4), const Gap(4),
Text(ele.alias, style: GoogleFonts.robotoMono()), Text(
'postCategory${ele.alias.capitalize()}'.trExists()
? 'postCategory${ele.alias.capitalize()}'.tr()
: ele.alias,
style: GoogleFonts.robotoMono(),
),
], ],
), ),
onTap: () {}, onTap: () {},

View File

@ -1,9 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gap/gap.dart'; import 'package:gap/gap.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:surface/providers/sn_network.dart'; import 'package:surface/providers/sn_network.dart';
import 'package:surface/widgets/dialog.dart';
class PostTagsField extends StatefulWidget { class PostTagsField extends StatefulWidget {
final List<String>? initialTags; final List<String>? initialTags;
@ -100,8 +102,7 @@ class _PostTagsFieldState extends State<PostTagsField> {
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
margin: const EdgeInsets.only(right: 8), margin: const EdgeInsets.only(right: 8),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
horizontal: 10.0, vertical: 4.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -248,14 +249,15 @@ class _PostCategoriesFieldState extends State<PostCategoriesField> {
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
margin: const EdgeInsets.only(right: 8), margin: const EdgeInsets.only(right: 8),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
horizontal: 10.0, vertical: 4.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
InkWell( InkWell(
child: Text( child: Text(
'#$category', 'postCategory${category.capitalize()}'.trExists()
? 'postCategory${category.capitalize()}'.tr()
: '#$category',
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
), ),