Sorting by name in Chinese
AstroAbyss opened this issue · 28 comments
I’m not sure if this is an issue, but after some consideration, I can only post it here.
I would like to know the sorting logic/principle of other languages, such as Chinese, when the sorting type is "name"?
Always better to ask then not! Maybe sometimes the "Discussions" are the best but not sure.
The sort should take the translated name into account as it comes from Minecraft
Yes, I am indeed hesitating whether to post it in "Discussions" instead of here.
That is to say, this sorting is based on Minecraft itself?
Yes, because this "name" sorting is practically unusable in Chinese contexts. We are more accustomed to sorting by the initial letters of pinyin.
The information I found is that Minecraft uses "Unicode" for sorting?
Minecraft supplies the translated name of the item and then we use Java's built in string comparator to compare them.
I've tested it in latin-based languages I know but I'm not sure how well it behaves with non-latin characters. I assume you found something?
Minecraft simply gives me the letters involved in the name of an item.
The "sort" itself happens within the programming language's internals but it seems like it's not smart enough for our needs.
Can you give me an unsorted list of strings please and then an expected order?
{
"unordered": ["this", "that", "and another one"],
"ordered": ["and another one", "that", "this"]
}
I can then use it for testing and know if I've solved the problem :)
The more comprehensive, the better!
My fault, that's it.
{
"unordered": ["下界合金", "苹果", "钻石"],
"disassembled": ["xia jie he jin", "ping guo", "zuan shi"],
"ordered": ["ping guo", "xia jie he jin", "zuan shi"]
}So like this in the end?
{
"unordered": ["下界合金", "苹果", "钻石"],
"ordered": ["苹果", "下界合金", "钻石"]
}
Fortunately for me I don't need to understand it, I just need to know what the expected output it for a given input :)
I also need to find ways to handle all other languages that have different rules like Arabic, Japanese, Korean and even French and some others. So the best you can do is give me a very comprehensive input-output list like above.
If I use the correct way to sort things, I should get the same output if I feed in our tests to it.
So like this in the end?
{ "unordered": ["下界合金", "苹果", "钻石"], "ordered": ["苹果", "下界合金", "钻石"] }
That's right
Because I am concerned that you may not understand the meaning of pinyin. :(
It is important to change Chinese characters to pinyin.
ChatGPT made me this:
{
"language": "Chinese (Simplified)",
"locale": "zh_CN",
"unordered": [
"白色混凝土",
"白色羊毛",
"白色陶瓦",
"红色地毯",
"黑色地毯",
"砖楼梯",
"砖墙",
"光滑的石头",
"透明冰",
"透明玻璃"
],
"expected_ordered": [
"白色混凝土",
"白色陶瓦",
"白色羊毛",
"光滑的石头",
"红色地毯",
"透明冰",
"透明玻璃",
"砖楼梯",
"砖墙",
"黑色地毯"
]
}
Is this correct by any chance?
There was a small mistake.
The correct sequence should be as follows:
{
"language": "Chinese (Simplified)",
"locale": "zh_CN",
"unordered": [
"白色混凝土",
"白色羊毛",
"白色陶瓦",
"红色地毯",
"黑色地毯",
"砖楼梯",
"砖墙",
"光滑的石头",
"透明冰",
"透明玻璃"
],
"expected_ordered": [
"白色混凝土",
"白色陶瓦",
"白色羊毛",
"光滑的石头",
"黑色地毯",
"红色地毯",
"透明冰",
"透明玻璃",
"砖楼梯",
"砖墙"
]
}Amazing, thank you!
I have a potential solution in mind. Will let you know if there's anything to test.
In the meantime if you know anyone who could supply more examples in other languages, don't hold back
You can think of them this way:
{
"unordered": [
"白色混凝土",
"白色羊毛",
"白色陶瓦",
"红色地毯",
"黑色地毯",
"砖楼梯",
"砖墙",
"光滑的石头",
"透明冰",
"透明玻璃"
],
"pinyin_initial": [
"b s h n t",
"b s y m",
"b s t w",
"h s d t",
"h s d t",
"z l t",
"z q",
"g h d s t",
"t m b",
"t m b l"
]
}Here's a small note: "光滑的石头" is not the correct translation, "平滑石头" is the accurate one. :)
Amazing, thank you!
I have a potential solution in mind. Will let you know if there's anything to test.
In the meantime if you know anyone who could supply more examples in other languages, don't hold back
Sure.
No, this is the effect displayed on the English (US) language interface.
There is indeed a display issue with the Chinese translation, as I copied the wrong emoji, so it has been corrected.
It should be pointed out that the display effect of emojis in Minecraft is not satisfactory. :(
Oh lol that's probably a minecraft issue. Minecraft in Chinese doesn't do the emoji well? Might be a bug report for Minecraft
The code shows the 💻 emoji as a text literal and nothing else. Feels like this is some weird edge case with Minecraft's new emoji formatting on Chinese computers. What does it say instead of the emojies?
No, this is the effect displayed on the English (US) language interface.
There is indeed a display issue with the Chinese translation, as I copied the wrong emoji, so it has been corrected. It should be pointed out that the display effect of emojis in Minecraft is not satisfactory. :(
This means that you used 🧡 in "support", But I used ❤ before.
This is so sad. 😢
https://github.com/KyrptonaughtMC/Inventory-Sorter/actions/runs/14559032810/artifacts/2975705588 this should be significantly better at sorting by name!
🎉 This issue has been resolved in version 2.0.3 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀





