examples icon indicating copy to clipboard operation
examples copied to clipboard

Localization example

Open JCash opened this issue 4 months ago • 1 comments

Describe the example you'd like I'd like to showcase our text layout feature that supports proper unicode layout, e.g. for RTL languages. I think having a "localisation" example is a good way to do it.

It could either be in a "game menu" with the different buttons, but as a layout example, it may be too small.

Some notes/ideas:

  • Use .appmanifest to enable the font layout feature

In example:

  • Choose localization (english, arabic, ...) via some in game button
  • add the extra font for arabic if selected. And remove it if deselected:
    • See font.add_font()/font.remove_font()
  • Get the localized text (e.g. lorem ipsum)
    • E.g. load from disk
  • See the text change (LTR, RTL) on screen

Note, the font.add_font() creates the font on-the-fly, so it may cause a delay in game. It would be good to experiment with loading the font + text_<language>.json from within a collection proxy, and then "hook up" the original font collection with the new font.

Lorem ipsum for different languages:

  • English - lipsum.com
  • Arabic - https://ar.lipsum.com/
  • Portuguese - https://pt.lipsum.com/
  • Japanese - https://generator.lorem-ipsum.info/_japanese

JCash avatar Oct 13 '25 14:10 JCash

Test project https://github.com/defold/extension-fontgen/tree/data-only

JCash avatar Oct 17 '25 13:10 JCash