Issues & Limitations

As I mentioned before, GM-I18n is still in very early stages of development, so you should be aware of the following issues before using it in your game.


Limited Support for HTML5 Export

GM-I18n is not fully compatible with HTML5 export yet. There are some issues with the font loading and drawing functions. For the drawing functions, I'm already working on it, but I still don't know how to solve it. If you have any idea or suggestion, please feel free to open an issue or start a discussion on the GitHub repository.

Issue with Font Loading

The font asset created either from the IDE or from code will not be loaded correctly in HTML5 export. It seems like the fonts is loaded asynchronously, so the font asset is not ready when the GM-I18n system tries to use it. This issue can be solved by setting the font manually after the font asset is loaded.

Temporary solution:

Create
// create the font asset if you're using non-Latin characters
global.font_ja = font_add("fonts/NotoSansJP-Medium.ttf", 32, 0, 0, 32, 127);    


// add a drawing preset for each locale
i18n_add_drawings("en", "header", [
    new I18nDrawings(fNotoSansMedium, fa_left, fa_middle, #FFFFFF, 0.65, 0, 1)
]);

i18n_add_drawings("ja", "header", [
    new I18nDrawings(global.font_ja, fa_left, fa_middle, #FFFFFF, 0.65, 0, 1)
]);


// refresh the drawing preset if it's running on browser
if (os_browser != browser_not_a_browser) {
    alarm_set(0, game_get_speed(gamespeed_fps) * 2);    // 2 seconds delay, change it to your needs
}
Alarm 0
var to_refresh = i18n_get_locales_code();   // get all locale codes
var font_locale = "font_";                  // global.font_* that we declared before

for (var i = 0; i < array_length(to_refresh); i++) {
    var presets = struct_get_names(global.i18n.data[$ to_refresh[i]].drawings);     // get all drawing presets
    
    for (var j = 0; j < array_length(presets); j++) {
        // set the font manually
        // if it's a latin-based language (eg. "en"), use the default font asset 
        // if it's not, use the font asset that we created before in the global.font_*
        // change the condition below to fit your needs!
        global.i18n.data[$ to_refresh[i]].drawings[$ presets[j]].font = (to_refresh[i] == "en") ? fNotoSansMedium : variable_global_get(font_locale + to_refresh[i]);
    }
}
You can find the alarm event in the oI18n object in the demo project. Don't worry, I'll try my best to fix this issue in the future.

Issue with Text Drawing

HTML5 Text Drawing Issue

There's no issue with text drawing if you're using Latin-based fonts. But, for non-Latin fonts, here's the issue that I found so far:

  1. The text is not drawn correctly. As you can see in the image above, the text is only drawn on the button.
  2. Even if it's drawn correctly, the text is not drawn in the correct configuration like in the drawing preset. For example, the font size, color, and alignment is not applied correctly.

Here's what I tried so far:

  1. I tried to use the draw_set_font built-in function instead of i18n_use_drawing or i18n_draw_message function, it doesn't work.
  2. I tried drawing the text manually using draw_text function (and its derivatives), it doesn't work. It also the same if I use the draw_set_font function.
  3. I change the Draw Event to Draw GUI Event. The text is drawn, but it's not drawn in the correct configuration like in the drawing preset.
  4. I tried to toggle the WebGL option in the HTML5 export settings. It doesn't work.

I'm completely stuck, so there's no temporary solution for this issue. If you have any idea or suggestion, please feel free to open an issue or start a discussion on the GitHub repository.

You can see the issue in action in the demo project (HTML5) and in the GitHub pages.

No Built-in Text Analysis Function

GM-I18n doesn't have any built-in text analysis function yet. So, if your translation is a "one word message", it will be drawn as a single line even if you set the width in the drawing preset.

Temporary solution: you have to add the newline character (\n) or space manually in the translation string.

before
{
    "text": "この文は静的です。選択されたロケールに翻訳されます。ロケールを変更してもこの文には影響しません。"
}
after
{
    "text": "この文は静的です。選択された ロケールに翻訳されます。ロケールを 変更してもこの文には影響しません。"
}

I've actually implemented a force_wrap parameter in the I18nDrawings constructor back then, but it was causing performance issue. Since GM-I18n is a performance-oriented library, I decided remove it for now. Stay tuned for future updates!

This issue is happening in any platform.

No Support for Complex Scripts

I've tested GM-I18n with some languages that has a complex script, like Arabic, and the text is not drawn correctly (no cursive connection between the characters). I haven't tested it with other complex script (such as Thai, Tamil, Devanagari, etc.) yet, but it's likely to have the same issue.

I had thought about implementing the RTL feature, but I decided to hold off for now (because languages that use RTL also use complex scripts). If you need it, feel free to open an issue or start a discussion on the GitHub repository.


  If you're ready to accept the issues above, then you're ready to use GM-I18n in your game!