-
-
Notifications
You must be signed in to change notification settings - Fork 284
feat: Add multi-language support (i18n) via JSON config #589
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
base: master
Are you sure you want to change the base?
Conversation
fix some bug
fix some bug
fix some bug
wuyilingwei
left a comment
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.
Looks fine
|
Nice work! One concern: the reflection-based approach using original text as keys feels fragile (some controls get overwritten, changes to wording break translations). Would you (and the original author) be open to moving toward stable keys and a standard i18n pattern (resource dictionaries) in the future? If so, I’m happy to help flesh it out. 👀 |
At first, I also wanted to try the separation. However, after I did it myself, I found that there would be a bunch of problems during the compilation. The current version is the result of my trade - offs, and it seems to be working quite well at present.🤔 |
|
Love this, and so much easier than going through the hassle of resource dictionary setups! |
However, it is worth noting that reflection based translation requires simultaneous modification/addition of the corresponding English/other language in the JSON whenever the string is changed |
Apart from adding the corresponding English and translation to JSON every time a new string is added, there are no other requirements |
Makes sense. If there’s no big refactor planned, the current approach works efficiently enough. 🚀 |
Hi! I implemented a translation system for CompactGUI.
It works by scanning the UI at runtime and replacing text using JSON files, so I didn't have to change your existing hardcoded strings (safe and clean).
What's new:
i18nfolder.🐛 One small heads-up (Help Needed):
The "View on GitHub" button currently disappears when the translation logic runs.
I suspect my reflection code is accidentally overwriting the button's complex content (Icon + Text) with a simple string. I'm not sure how to fix this specific button without breaking the loop, so I might need your help on that part! 😅
Hope this helps more people use this tool!
This is the modified interface and effect I have created.


