Using ParameterizedText with Chinese language
Posted: Mon Sep 28, 2020 5:54 pm
Hi everyone, hope someone can help me out.
I'm writing a VN and have been working with a publisher who needs Chinese translation in the game. However, the various fonts I use for displaying in the game do not support Chinese characters and so have implemented a way to register the new font for the say screen. This is fine, but I also have some ParameterizedText set up to show as Chapter screens. Currently, the three different types of ParameterizedText are set up as follows:
I implement the chapter text at the top of each chapter script:
When the language is changed to Chinese however, these headings disappear. So, the only way I can see of getting it to work is to declare additional ParameterizedText specifically for the Chinese font:
And then when implementing:
Bear in mind this is just for simplified_chinese, I'll have to deploy an additional if conditional for traditional. Also, be aware that these English lines have already been translated in the translation folders, so I know it looks odd to have to write the same thing twice, but the one for simplified Chinese will be translated.
All this seems rather complex and unnecessary as I am sure there is a much easier, more succinct way to get this to work. Is there a way to somehow make it so I only need to declare one style and then it be switched when the user changes languages?
I'm writing a VN and have been working with a publisher who needs Chinese translation in the game. However, the various fonts I use for displaying in the game do not support Chinese characters and so have implemented a way to register the new font for the say screen. This is fine, but I also have some ParameterizedText set up to show as Chapter screens. Currently, the three different types of ParameterizedText are set up as follows:
Code: Select all
## TEXT AND HEADINGS
image screen_text = ParameterizedText(xalign=0.5, yalign=0.5, size=40, font=gui.name_text_font)
image chapter_text = ParameterizedText(xalign=0.5, yalign=0.46, size=60, font=gui.name_text_font)
image chapter_name_text = ParameterizedText(xalign=0.5, yalign=0.53, size=50, font=gui.name_text_font)
Code: Select all
show chapter_text "Chapter 1"
show chapter_name_text "Chapter Name Here"Code: Select all
## TEXT AND HEADINGS
image screen_text = ParameterizedText(xalign=0.5, yalign=0.5, size=40, font=gui.name_text_font)
image chapter_text = ParameterizedText(xalign=0.5, yalign=0.46, size=60, font=gui.name_text_font)
image chapter_name_text = ParameterizedText(xalign=0.5, yalign=0.53, size=50, font=gui.name_text_font)
## For Simplified Chinese
image screen_text_sc = ParameterizedText(xalign=0.5, yalign=0.5, size=40, font="gui/fonts/NotoSansSC-Regular.otf")
image chapter_text_sc = ParameterizedText(xalign=0.5, yalign=0.46, size=60, font="gui/fonts/NotoSansSC-Regular.otf")
image chapter_name_text_sc = ParameterizedText(xalign=0.5, yalign=0.53, size=50, font="gui/fonts/NotoSansSC-Regular.otf")
## For Traditional Chinese
image screen_text_tc = ParameterizedText(xalign=0.5, yalign=0.5, size=40, font="gui/fonts/NotoSansTC-Regular.otf")
image chapter_text_tc = ParameterizedText(xalign=0.5, yalign=0.46, size=60, font="gui/fonts/NotoSansTC-Regular.otf")
image chapter_name_text_tc = ParameterizedText(xalign=0.5, yalign=0.53, size=50, font="gui/fonts/NotoSansTC-Regular.otf")Code: Select all
if _preferences.language == "simplified_chinese":
show chapter_text_sc "Chapter 1"
show chapter_name_text_sc "Chapter Name Here"
else:
show chapter_text "Chapter 1"
show chapter_name_text "Chapter Name Here"All this seems rather complex and unnecessary as I am sure there is a much easier, more succinct way to get this to work. Is there a way to somehow make it so I only need to declare one style and then it be switched when the user changes languages?