@@ -632,10 +632,28 @@ final class ModListPageSkin extends SkinBase<ModListPage> {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modTranslations != null && I18n.isUseChinese() && !modInfo.getName().equals(modTranslations.getName()))
|
|
||||||
content.setTitle(modInfo.getName() + " (" + modTranslations.getName() + ")");
|
String displayName = modInfo.getName();
|
||||||
else
|
if (modTranslations != null && I18n.isUseChinese()) {
|
||||||
content.setTitle(modInfo.getName());
|
String chineseName = modTranslations.getName();
|
||||||
|
if (StringUtils.containsChinese(chineseName)) {
|
||||||
|
if (StringUtils.containsEmoji(chineseName)) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
chineseName.codePoints().forEach(ch -> {
|
||||||
|
if (ch < 0x1F300 || ch > 0x1FAFF)
|
||||||
|
builder.appendCodePoint(ch);
|
||||||
|
});
|
||||||
|
|
||||||
|
chineseName = builder.toString().trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(chineseName) && !displayName.equalsIgnoreCase(chineseName)) {
|
||||||
|
displayName = displayName + " (" + chineseName + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
content.setTitle(displayName);
|
||||||
|
|
||||||
StringJoiner joiner = new StringJoiner(" | ");
|
StringJoiner joiner = new StringJoiner(" | ");
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public final class StringUtils {
|
|||||||
builder.append(str, start, i);
|
builder.append(str, start, i);
|
||||||
}
|
}
|
||||||
builder.append(' ');
|
builder.append(' ');
|
||||||
i = whitespaceEnd ;
|
i = whitespaceEnd;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -261,6 +261,19 @@ public final class StringUtils {
|
|||||||
return false;
|
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) {
|
private static boolean isVarNameStart(char ch) {
|
||||||
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_';
|
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '_';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user