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
Chinese language support #4
Chinese language support #4
Conversation
src/ninjabrainbot/gui/GUI.java
Outdated
|
||
// Load fonts | ||
Profiler.stopAndStart("Load fonts"); | ||
try { | ||
font = Font.createFont(Font.TRUETYPE_FONT, Main.class.getResourceAsStream("/resources/OpenSans-Regular.ttf")); | ||
fontLight = Font.createFont(Font.TRUETYPE_FONT, Main.class.getResourceAsStream("/resources/OpenSans-Light.ttf")); | ||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); | ||
ge.registerFont(font); | ||
ge.registerFont(fontLight); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
|
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.
Why is this removed, is it incompatible with chinese characters? The text looks much worse with the default font.
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.
Okay I see why you removed it, what I dont understand is why it works fine on certain labels and on others it doesnt. For example almost all labels in the settings menu are fine with, but not in the main window.
I am not going to remove the better looking font for english users, but I wonder if there is a better solution than to just hard code it and say "use the default font if chinese, otherwise load this font".
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.
Because this font cannot display Chinese.
I tried to introduce Chinese fonts, but that would have made the package too big. Maybe I can make Chinese use the default fonts of the operating system and English use the built-in fonts.
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.
Maybe I can try to solve the problem.
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.
The font is set everywhere, since ThemedLabels are used everywhere. I think the reason it works in some places is because some labels are enclosed in html tags, which may cause the text to use a default font if a characted doesnt exist in the used font. I would rather not use html tags everywhere though, I think the best solution is to just use different fonts for different languages.
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.
ill fix this
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.
I need to go to bed because it's midnight here.
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.
fixed in 0eeb34d
src/ninjabrainbot/util/I18n.java
Outdated
@@ -16,7 +16,7 @@ | |||
* @since 2021/12/25 14:39 | |||
*/ | |||
public class I18n { | |||
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("resources/lang/I18n", Locale.getDefault(), new UTF8Control()); | |||
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("resources/lang/I18n", Locale.US, new UTF8Control()); |
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.
Also, how exactly does it know which language to choose, it seems to me that it will always be english based on this line.
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.
I forgot to change back to the original version when I was testing My English
Is the en_US file necessary? The default will be used if it is absent, so it can just be deleted right? |
Thank you for doing this! I changed the title back to "Ninjabrain Bot" because I dont think the name should be translated, but let me know if you really think it should be. |
The changes will be in the next release, but until then I made this prerelease v1.1.1-pre1 |
It is really unnecessary to translate the title. |
Chinese language support.
In our country, many friends are using this software, so we have made multi-language support, but there may be some problems due to the large changes in the code.