fyne
fyne copied to clipboard
About internationalization related support
I'm trying to develop desktop app which should display chinese.but chinese is not supported by fyne's default font .
I know I can change font to display chinese by set theme , but I want reserve default font and display chinese.
I try to reserve more than one font,and can set the priority of different fonts, if the font with the highest priority cannot be displayed, try to find a font with a lower priority.
Its might be this:
`
t := getFontsByPath(path) app.Settings().addfont(t)
`
or
`
t := getFonts.ByPath(path) app.Settings().Setfonts(default,t)
`
I'm wondering if you need this feature. sry for my poor english
I just knew this project today and also wonder about internationalization/localization. How does translation of resources work?
I dont know either , but this project is not support more than one .ttf , so internationalization/localization might cause some bugs
I just knew this project today and also wonder about internationalization/localization. How does translation of resources work?
You can use any internationalisation package to handle translations. We are considering adding it in a future release, but for now you could use things like https://github.com/nicksnyder/go-i18n
I try to reserve more than one font,and can set the priority of different fonts, if the font with the highest priority cannot be displayed, try to find a font with a lower priority.
Fyne already delegates down to the built-in font, If your theme or user font cannot handle a glyph it will be drawn using the builtin font. I don't know if this is enough for your needs, but it covers many use-cases.
@andydotxyz , I'm facing the original issue of this topic now. I do not think it is a good idea to build-in fonts, instead of them in-system. Because I want to enable i18n, I cannot pack all fonts needed. The conclusion in https://github.com/fyne-io/fyne/issues/2660 is same as this topic, and does not seem to match your comment that Fyne can delegate to built-in fonts.
When I stated that fyne will fall back to built-in fonts what I meant is that if runes cannot be rendered in your FYNE_THEME specified font then it will fall back to the one bundled by the toolkit. This is accurate.
What we don't support yet is falling back to some OS-installed font. It may be required but is not supported in current releases.
@andydotxyz , thanks a lot for your explanation. I did not expect the toolkit to pack ANY fonts at all. I used Ultimate+ for C and did not care about fonts. IMO, it is unacceptable not to use OS fonts. I did not even see any information on using them in a customized theme. Isn't this a huge drawback to i18n?
IMO, it is unacceptable not to use OS fonts
The challenge we have is that not all OS are packaged with good fonts out of the box (particularly BSD, some Linux). As I mentioned above we intend to support delegating to system but do not support it now.
import (_ "github.com/lengzhao/font/autoload") This will automatically load the fonts in the system without additional settings (automatically obtain the system language, find all system fonts, and configure the first matching font):https://github.com/lengzhao/font