I have difficulties trying to get foreign language to show.

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Roro
Newbie
Posts: 7
Joined: Sun Oct 05, 2014 7:29 pm
Contact:

I have difficulties trying to get foreign language to show.

#1 Post by Roro » Sat Oct 18, 2014 2:30 pm

I'm having a bit of trouble trying to get Japanese characters to show in the game.

I have some Japanese although I plan on making my game completely English.

I tried using the language codes I found on renpy.org and from the wikia but when I copy and pasted, there was always an error. I attempted to change the fonts for Japanese using a code like--

Code: Select all

init python:
     style.default.language = "japanese-normal"
and even something like:

Code: Select all

SetField(config,"font","msyh.ttf")
((^^^I didn't copy it exactly to my script.))

--but, every time I launched the game, I get an error message. Sometimes when I'm lucky I would be able to launch it but when I load the save file to the part where Japanese shows up, the characters shows up as boxes.
language_not_supported.PNG
This is where the first Japanese line is.
language_not_supported.PNG (66.26 KiB) Viewed 965 times
I'm a beginner to coding and making visual novels. I also searched for any topics relating to my issue but they're all different.

I'm not sure if there are other codes I should add to the very beginning of the coding script or I should add a code before my Japanese lines to have them show up legible.

I attempted to take alternative routes to having Japanese show. I used Multi-Path Translation codes (it was too advance for me) and I also tried using Language-Dependent Initialization codes (also too advance for me).

Code: Select all

    br "..."
    
    br "!!!" with hpunch
    
    br "(ARE YOU KIDDING ME.)"
    
    br "(クラウド センセイ !!!)"
    
    br "(I CAN'T BREATH.)"
    
    br "(I FEEL LIKE I KNOW HIM FROM SOMEWHERE.)"
That's the code to the first Japanese line. I have not added any language supporting codes as of right now.

If that was confusing to understand then,

What I want is to have my Japanese lines show in game but when I add Japanese into the coding script and launch the game, it shows up as boxes. I have no font codes or language codes in the script as of right now because I'm not sure which ones to use. I did attempt to use them though and it all came out a mess. I don't want my entire game to be in Japanese because I'm set on publishing it in Western countries. Should I download fonts and move it into my game folder or does ren'py have fonts that supports other languages?

In conclusion, my game has a thing where it's in English for the most part but there will be Japanese that shows up from time to time and I want to have both displayed.

I'm sorry if my description and explanation is a bit messy and confusing.

User avatar
PyTom
Ren'Py Creator
Posts: 15431
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: I have difficulties trying to get foreign language to sh

#2 Post by PyTom » Sat Oct 18, 2014 3:36 pm

You want:

Code: Select all

style default:
    font "mikachan.ttf"
Where mikachan.ttf is a japanese font in the game directory.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Roro
Newbie
Posts: 7
Joined: Sun Oct 05, 2014 7:29 pm
Contact:

Re: I have difficulties trying to get foreign language to sh

#3 Post by Roro » Sat Oct 18, 2014 6:37 pm

PyTom wrote:You want:

Code: Select all

style default:
    font "mikachan.ttf"
Where mikachan.ttf is a japanese font in the game directory.
I placed that at the very top in the coding script (which I wasn't suppose to do maybe) and it sent me a full traceback.

I moved it above the Japanese line then launched the game then it said that "parsing the script failed"

Code: Select all

File "game/script.rpy", line 404: style property br is not known.
    br "(☐☐☐☐ ☐☐☐☐ ☐☐☐)"
That was the only thing that showed up.

I'm using Katakana. Is the Japanese syllabary causing the problem?

User avatar
Alex
Lemma-Class Veteran
Posts: 2317
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: I have difficulties trying to get foreign language to sh

#4 Post by Alex » Sun Oct 19, 2014 11:46 am

What was the error when you've placed this code at the top of your code? What version of Ren'Py do you use?
And about the style property error - this looks like you've broke the indentation of the lines. I guess it was looking like

Code: Select all

    br "(ARE YOU KIDDING ME.)"
style default:
    font "mikachan.ttf"    
    br "(クラウド センセイ !!!)"
... so the last line became the part of style declaration block and this caused the error.
http://www.renpy.org/doc/html/style.htm ... -statement

User avatar
Roro
Newbie
Posts: 7
Joined: Sun Oct 05, 2014 7:29 pm
Contact:

Re: I have difficulties trying to get foreign language to sh

#5 Post by Roro » Sun Oct 19, 2014 6:09 pm

Alex wrote:What was the error when you've placed this code at the top of your code? What version of Ren'Py do you use?
And about the style property error - this looks like you've broke the indentation of the lines. I guess it was looking like

Code: Select all

    br "(ARE YOU KIDDING ME.)"
style default:
    font "mikachan.ttf"    
    br "(クラウド センセイ !!!)"
... so the last line became the part of style declaration block and this caused the error.
http://www.renpy.org/doc/html/style.htm ... -statement
I placed the code like:

Code: Select all

    br "(ARE YOU KIDDING ME.)"

style default:
    font "mikachan.ttf"    
     
    br "(クラウド センセイ !!!)"
with spaces between the lines.

And the error was:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 404: style property br is not known.
    br "(クラウド センセイ !!!)"
       ^

Ren'Py Version: Ren'Py 6.18.1.670
That was all that showed up and nothing else.

The version I'm using is Ren'py 6.18.1.

User avatar
Alex
Lemma-Class Veteran
Posts: 2317
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: I have difficulties trying to get foreign language to sh

#6 Post by Alex » Mon Oct 20, 2014 3:41 pm

That's ok, 'cause the space between lines do nothing at all, the indentation (spaces at the beginning of each line) do matters.
So, try

Code: Select all

style default:
    font "mikachan.ttf"

define br = Character ("Bariie")

label start:
    br "..."
    
    br "!!!" with hpunch
    
    br "(ARE YOU KIDDING ME.)"
    
    br "(クラウド センセイ !!!)"
    
    br "(I CAN'T BREATH.)"
    
    br "(I FEEL LIKE I KNOW HIM FROM SOMEWHERE.)"
... and post the error message if you'll get one.

http://www.renpy.org/wiki/renpy/FAQ#How ... _blocks.3F
http://www.renpy.org/doc/html/language_ ... and-blocks

User avatar
Roro
Newbie
Posts: 7
Joined: Sun Oct 05, 2014 7:29 pm
Contact:

Re: I have difficulties trying to get foreign language to sh

#7 Post by Roro » Sat Oct 25, 2014 4:40 pm

Alex wrote:That's ok, 'cause the space between lines do nothing at all, the indentation (spaces at the beginning of each line) do matters.
So, try

Code: Select all

style default:
    font "mikachan.ttf"

define br = Character ("Bariie")

label start:
    br "..."
    
    br "!!!" with hpunch
    
    br "(ARE YOU KIDDING ME.)"
    
    br "(クラウド センセイ !!!)"
    
    br "(I CAN'T BREATH.)"
    
    br "(I FEEL LIKE I KNOW HIM FROM SOMEWHERE.)"
... and post the error message if you'll get one.

http://www.renpy.org/wiki/renpy/FAQ#How ... _blocks.3F
http://www.renpy.org/doc/html/language_ ... and-blocks
Thank you so much for trying to help me!

But sadly, it keeps giving me the same error.

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 404: style property br is not known.
    br "(クラウド センセイ !!!)"
       ^

Ren'Py Version: Ren'Py 6.18.1.670
I really appreciate your assistance!

I'm going to find an alternative to do this.

Thank you again, I really appreciate it.

User avatar
Alex
Lemma-Class Veteran
Posts: 2317
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: I have difficulties trying to get foreign language to sh

#8 Post by Alex » Sat Oct 25, 2014 5:41 pm

Hm, have you changed the code at all (the error message didn't changed)? Didn't you restore game from the save made before you've change the code?
What's the code in lines from 400 to 408?

017Bluefield
Regular
Posts: 91
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain
Deviantart: playerzero17
itch: autumn-rain
Contact:

Re: I have difficulties trying to get foreign language to show.

#9 Post by 017Bluefield » Mon Jul 23, 2018 2:58 am

The Japanese I'm trying to use isn't rendering. And when I tried to use this font, I wound up with this:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
Exception: Could not find font u'game/fonts/Source Han OTF/JP/SourceHanSerifJP-Regular.otf'.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\ast.py", line 862, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\python.py", line 1912, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in <module>
    python hide:
  File "renpy/common/_layout/screen_main_menu.rpym", line 35, in _execute_python_hide
    ui.interact()
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\ui.py", line 287, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2649, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\core.py", line 3132, in interact_core
    self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\core.py", line 2055, in draw_screen
    renpy.config.screen_height,
  File "render.pyx", line 485, in renpy.display.render.render_screen
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 717, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 717, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 717, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\screen.py", line 669, in render
    child = renpy.display.render.render(self.child, w, h, st, at)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 717, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 1117, in render
    st, at)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 877, in render
    surf = render(d, rw, height - y, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 1117, in render
    st, at)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 1564, in render
    cwidth, cheight = sizeit('c', width, height, 0, 0)
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 1559, in sizeit
    rend = render(pos_d[pos], width, height, st, at)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\viewport.py", line 262, in render
    surf = renpy.display.render.render(self.child, child_width, child_height, st, at)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 919, in render
    surf = render(d, width - x, rh, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\display\layout.py", line 919, in render
    surf = render(d, width - x, rh, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\text\text.py", line 1825, in render
    virtual_layout = Layout(self, width, height, renders, drawable_res=False, size_only=True)
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\text\text.py", line 592, in __init__
    glyphs = ts.glyphs(s, self)
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\text\text.py", line 238, in glyphs
    fo = font.get_font(self.font, self.size, self.bold, self.italic, 0, self.antialias, self.vertical, self.hinting, layout.oversample)
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\text\font.py", line 664, in get_font
    face = load_face(fn)
  File "C:\Users\*******\Documents\RenPy\renpy-6.99.12.4-sdk\renpy\text\font.py", line 605, in load_face
    raise Exception("Could not find font {0!r}.".format(orig_fn))
Exception: Could not find font u'game/fonts/Source Han OTF/JP/SourceHanSerifJP-Regular.otf'.

Windows-8-6.2.9200
Ren'Py 7.0.0.196
Project Bluefield - Origins 0.0.0.1.15.05
Mon Jul 23 00:04:48 2018

User avatar
Saltome
Veteran
Posts: 231
Joined: Sun Oct 26, 2014 1:07 pm
Deviantart: saltome
Contact:

Re: I have difficulties trying to get foreign language to show.

#10 Post by Saltome » Mon Jul 23, 2018 11:57 am

When you save the game Ren'py preserves its entire state.
Changing the font in the beginning of the game then loading a save file that had the old font probably wouldn't work.
Deviant Art: Image

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Jake's Love Story, NEKOKORO
Projects: Courage for a Kiss
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: I have difficulties trying to get foreign language to show.

#11 Post by mikolajspy » Mon Jul 23, 2018 2:54 pm

EDIT: Whooops! I just noticed it's some grave digging thread, so if you get this error:

Code: Select all

Exception: Could not find font u'game/fonts/Source Han OTF/JP/SourceHanSerifJP-Regular.otf'
it simply means it's not there. Better avoid using spaces and '-' in folder and file names.
-----------------
If it's just one sentence from time to time, try:

Code: Select all

br "{font=msyh.tff}(クラウド センセイ !!!){/font}"
You can also define character speaking in japanese, something like (just guessing, not sure if property what_font exists, but similar like these, do so...):

Code: Select all

define brj = Character ("Bariie", what_font='msyh.tff')
Just make sure you actually have font file named like that (based on first post), and the font actually supports japanese characters, and it should work :)
ImageImageImage

017Bluefield
Regular
Posts: 91
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain
Deviantart: playerzero17
itch: autumn-rain
Contact:

Re: I have difficulties trying to get foreign language to show.

#12 Post by 017Bluefield » Tue Jul 24, 2018 12:42 am

Okay, so...how do I get it to work for a full translation?

EDIT:
Saltome wrote:
Mon Jul 23, 2018 11:57 am
When you save the game Ren'py preserves its entire state.
Changing the font in the beginning of the game then loading a save file that had the old font probably wouldn't work.
Checked that, just in case, but the problem I'm looking at isn't based in the save files.

EDIT 2:
mikolajspy wrote:
Mon Jul 23, 2018 2:54 pm
EDIT: Whooops! I just noticed it's some grave digging thread, so if you get this error:

Code: Select all

Exception: Could not find font u'game/fonts/Source Han OTF/JP/SourceHanSerifJP-Regular.otf'
it simply means it's not there. Better avoid using spaces and '-' in folder and file names.
Switched to a different font without spaces or "-"s. Still have the same problem, though.

Should note that there's only two places where Japanese is rendering correctly in my script:

Project Bluefield Origins\game\tl\japanese\options.rpy

Code: Select all

# TODO: Translation updated at 2018-07-19 23:42

translate japanese strings:

    # options.rpy:15
    old "Project Bluefield - Origins"
    new "プロジェクト ブルーフィールド - オリジンズ"
Project Bluefield Origins\game\screens.rpy

Code: Select all

        hbox:
            box_wrap True
            vbox:
                style_prefix "radio"
                label _("Language")
                textbutton "English" action Language(None)
                textbutton u"{font=SmartFontUI.otf}日本語{/font}" action Language("japanese")
Yes, I know that that's the font tag's job, but I should point out that this isn't about the OP (whoops); this is for a full translation of my project. As such, using so many font tags for this is...inconvenient.

Post Reply

Who is online

Users browsing this forum: No registered users