mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
translate tags on block dialog.
This commit is contained in:
@@ -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(() {
|
||||
|
@@ -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(':');
|
||||
|
Reference in New Issue
Block a user