translate tags on block dialog.

This commit is contained in:
2025-02-15 21:51:05 +08:00
parent 14837e2543
commit b8e4cc5937
2 changed files with 12 additions and 1 deletions

View File

@@ -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(':');