diff --git a/lib/components/comic.dart b/lib/components/comic.dart index 7808434..aaad1ab 100644 --- a/lib/components/comic.dart +++ b/lib/components/comic.dart @@ -463,7 +463,9 @@ class ComicTile extends StatelessWidget { children: [ for (var word in all) OptionChip( - text: word, + text: (comic.tags?.contains(word) ?? false) + ? word.translateTagIfNeed + : word, isSelected: words.contains(word), onTap: () { setState(() { diff --git a/lib/utils/tags_translation.dart b/lib/utils/tags_translation.dart index b92b52e..f876283 100644 --- a/lib/utils/tags_translation.dart +++ b/lib/utils/tags_translation.dart @@ -52,6 +52,15 @@ extension TagsTranslation on String{ /// translate tag's text to chinese String get translateTagsToCN => _translateTags(this); + String get translateTagIfNeed { + var locale = App.locale; + if (locale.languageCode == "zh") { + return translateTagsToCN; + } else { + return this; + } + } + static String translateTag(String tag) { if(tag.contains(':') && tag.indexOf(':') == tag.lastIndexOf(':')) { var [namespace, text] = tag.split(':');