1

How to load multiple languages for gameplay3d? I want to join other countries to support the text.

rhughes
  • 9,257
  • 11
  • 59
  • 87
aipame
  • 43
  • 2

1 Answers1

1

Without knowing much about this engine, it seems that you can create your own ASCII fonts, and thus render those easily.

What you could do is create a simple multi-language system yourself with each language having a gameplay::Font object of its own.

See here for some more information on how to use this object: https://github.com/blackberry/GamePlay/wiki/Text-and-Fonts

of the gameplay3d forum if you haven't already tried it: http://www.gameplay3d.org/forums/

A basic multi-language system could be something like the following pseudo-code:

class LanguageManager
{
    private Language _currentLanguage = Language.enUS;
    private gameplay::Font[] _fonts;
    private gameplay::Font _currentFont;

    public void SetCurrentLanguage(Language l)
    {
        this._currentLanguage = l;
        this._currentFont = this.GetFontFromCurrentLanguage();
    }

    public void RenderString(string key, int x, int y, etc....)
    {
        string s = this.GetTextFromKey(key);

        this._currentFont.drawText(.....);
    }

    private GetFontFromCurrentLanguage()
    {
        etc...
    }

    private GetTextFromKey(string key)
    {
        // get the text from a the resource file
    }
}

You can store all of the language translations in a simple file with the following format and get the value from the above LanguageManager.GetTextFromKey method:

GameText.txt
[language]
key value

for instance
[enUS]
options Options
exit Exit

[zhCN]
options 选择
exit 离开
rhughes
  • 9,257
  • 11
  • 59
  • 87