Skip to content
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

[WIP] Translate ImGui strings #7959

Open
wants to merge 1 commit into
base: master
from

Conversation

7 participants
@Techjar
Copy link
Contributor

Techjar commented Apr 5, 2019

Pretty straightforward. As a bonus, both of these strings already exist on our translation files.

DO NOT MERGE THIS YET! We need to add multilingual fonts to ImGui first.

@JosJuice

This comment has been minimized.

Copy link
Contributor

JosJuice commented Apr 5, 2019

I'm not sure if this is a good idea. We haven't set up imgui to be able to use fonts for non-Western languages, so if you have Dolphin set to a non-Western language you'll just get a bunch of squares or something. Moving to imgui from the old OSD system did give us the ability to use more than just plain ASCII, though.

@Techjar

This comment has been minimized.

Copy link
Contributor Author

Techjar commented Apr 5, 2019

Ah, I didn't realize that. I'll just leave this PR open until we introduce multilingual fonts.

@BhaaLseN

This comment has been minimized.

Copy link
Member

BhaaLseN commented Apr 5, 2019

Which font is it even using right now? I don't see any (obvious) calls that would set/change it.

@Techjar

This comment has been minimized.

Copy link
Contributor Author

Techjar commented Apr 5, 2019

It's using a built-in default font, documented here: https://github.com/ocornut/imgui/tree/master/misc/fonts

@mbc07

This comment has been minimized.

Copy link
Contributor

mbc07 commented Apr 6, 2019

Well, Dolphin already ships with Droid Sans (included in Sys\GC) so, maybe use that? Assuming the gc-font-tool processing to generate the binaries can be easily reverted, of course...

@Techjar

This comment has been minimized.

Copy link
Contributor Author

Techjar commented Apr 6, 2019

No, it needs to be in TTF format. That file doesn't include a full multilingual character set anyways.

@AlexApps99

This comment has been minimized.

Copy link

AlexApps99 commented Apr 6, 2019

Well the first thing to decide is what font will we be using?
How many languages does this font need to support?

@lioncash

This comment has been minimized.

Copy link
Member

lioncash commented Apr 6, 2019

Ideally it should handle glyphs for all potentially common languages. At bare (unpreferable) minimum, the languages listed here

@AlexApps99

This comment has been minimized.

Copy link

AlexApps99 commented Apr 6, 2019

Should we use Noto?
It's the most multilingual font I can find. It is quite a big file though... (20mb)
This surely should support all transifex languages, with 582 lanugages supported.

Another thought: do dear imgui fonts need to be monospace?

@Techjar

This comment has been minimized.

Copy link
Contributor Author

Techjar commented Apr 8, 2019

Nah, ImGui can handle any kind of font. I'm not sure we want to add a 20MB font to the resources though, that would bloat the download size a lot (basically double).

@AlexApps99

This comment has been minimized.

Copy link

AlexApps99 commented Apr 9, 2019

Roboto?
Has good language support and a smaller file size (<200kb).
Frequently used on android and web design

@JosJuice

This comment has been minimized.

Copy link
Contributor

JosJuice commented Apr 9, 2019

Roboto only supports Latin, Greek and Cyrillic. To support all the languages that we currently ship translations for, you also need Arabic, Chinese, Japanese and Korean, and that is not going to fit into as little as 200 kb.

It would probably be best to go with fonts provided by the OS, but how do we pick appropriate fonts for each OS? Just hardcode a map of (OS, language) -> font?

@AlexApps99

This comment has been minimized.

Copy link

AlexApps99 commented Apr 9, 2019

I think we should keep the font simple and builtin to Dolphin, but allow the user to choose their own international font through an option in interface settings (a file browser for a .ttf file). Then it supports any users' computer and locale while staying light.

@JosJuice

This comment has been minimized.

Copy link
Contributor

JosJuice commented Apr 9, 2019

Users shouldn't be expected to manage fonts manually just because they don't speak a language that comes from Europe.

@AlexApps99

This comment has been minimized.

Copy link

AlexApps99 commented Apr 9, 2019

I don't think a font map is the way to go though, most OSes need international fonts to be installed in separate fonts/packages so it will not be an easy task to support every language without bundling any fonts.

@JosJuice

This comment has been minimized.

Copy link
Contributor

JosJuice commented Apr 9, 2019

OSes nowadays don't require any separate installs for the fonts of the big languages as far as I know. That's more of a thing from the Windows XP era. And the DolphinQt GUI isn't going to be able to render text if you don't have a system font for the language you're using, so it's not a problem if the imgui GUI also is unable to render text in that case.

@AlexApps99

This comment has been minimized.

Copy link

AlexApps99 commented Apr 9, 2019

What I meant was that every language is contained in a separate font, especially languages with specific glyphs like Chinese, Japanese etc so there is no one .ttf to support all languages.

@Warepire

This comment has been minimized.

Copy link

Warepire commented Apr 9, 2019

Based on what I can find in the imgui API you can only load a font based on a ttf. So, If you want to load a font based on a users system settings, you probably need to do a OS specific solution and query settings based on FontConfig in Linux, and equivalent features on Mac, Windows, etc.

(Based on ~5 minutes of research)

@Techjar

This comment has been minimized.

Copy link
Contributor Author

Techjar commented Apr 9, 2019

I wouldn't be opposed to using OS-specific APIs to find system fonts. It sounds less messy than just hard-coding magic font names and assuming they will exist.

@AlexApps99

This comment has been minimized.

Copy link

AlexApps99 commented Apr 9, 2019

Since imgui can only use a .ttf file there's no real way to support all languages at once unless it dynamically switches font based on text locale. Is there another way around it?

@Techjar

This comment has been minimized.

Copy link
Contributor Author

Techjar commented Apr 9, 2019

ImGui can load fonts from multiple files at once...

@Techjar Techjar changed the title NetPlayChatUI: Translate strings [WIP] Translate ImGui strings Apr 9, 2019

@AlexApps99

This comment has been minimized.

Copy link

AlexApps99 commented Apr 9, 2019

But how does it know which one to use for each case?

@JosJuice

This comment has been minimized.

Copy link
Contributor

JosJuice commented Apr 9, 2019

Even if we did have a big font file containing every glyph we need for every language, loading all of it at once would end up creating a huge texture on the GPU, so we'll most likely need to load different glyphs depending on the current language regardless of whether we're using separate font files.

@Techjar

This comment has been minimized.

Copy link
Contributor Author

Techjar commented Apr 9, 2019

ImGui can also load glyphs selectively.

@AlexApps99

This comment has been minimized.

Copy link

AlexApps99 commented Apr 9, 2019

Ok, thanks for the explanations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.