-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
优化模组翻译匹配 #3231
base: main
Are you sure you want to change the base?
优化模组翻译匹配 #3231
Conversation
解决特殊情况:`EntityCulling`与`Entity Culling `
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要做模糊匹配
|
||
return modIdMap.get(id); | ||
String filteredName = name.replaceAll("[^a-zA-Z0-9]", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以解释下这行代码吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
去掉除英文字母和数字的字符进行匹配,modSubnameMap 中的内容也是过滤后的内容
我觉得用 subname 匹配不是个好主意。mod_data.txt 的 13825 个条目中,有 7769 个条目都没有 subname。 分析 mod_data.txt 可以发现:
因此,比较好的匹配方法可能是 同时匹配 modid 和 subname。 |
if (StringUtils.isNotBlank(subname)) { | ||
String filteredSubName = "subname-" + subname.replaceAll("[^a-zA-Z]", ""); | ||
return modMap.get(filteredSubName); | ||
} | ||
|
||
if (StringUtils.isNotBlank(id)) { | ||
return modMap.get(id); | ||
} | ||
|
||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yushijinhun 已改成优先使用 subname 匹配,如果没有 subname 则使用 id 进行匹配
原理是更换成本地模组 name 和 mod_data.txt 的 subname 进行配对,因为这俩很多模组都是匹配的
顺便搞定了没有中文就不显示的情况