优化模组中文译名展示方式 (#4636)

1. 隐藏不包含中文字符的译名
2. 过滤译名中的 Emoji
This commit is contained in:
Glavo
2025-10-09 16:34:33 +08:00
committed by GitHub
parent 96f16382c0
commit c8edf4be62
2 changed files with 36 additions and 5 deletions

View File

@@ -87,7 +87,7 @@ public final class StringUtils {
builder.append(str, start, i);
}
builder.append(' ');
i = whitespaceEnd ;
i = whitespaceEnd;
continue;
}
}
@@ -261,6 +261,19 @@ public final class StringUtils {
return false;
}
public static boolean containsEmoji(String str) {
for (int i = 0; i < str.length(); ) {
int ch = str.codePointAt(i);
if (ch >= 0x1F300 && ch <= 0x1FAFF)
return true;
i += Character.charCount(ch);
}
return false;
}
private static boolean isVarNameStart(char ch) {
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_';
}