gb.language.get

Description

const char* gb.language.get( const MultiLang* lang [, uint8_t length] )

gb.language.get fetches the pointer off a MultiLang array "lang" and returns the correct one, according to the current langauge set. The length of the array is autodetermined, if not possible you will have to manually set it. It is possible to set a global default via config-gamebuino.h "LANGUAGE_DEFAULT_SIZE"

Parameters

  • const MultiLang* lang: multi-language array
  • uint8_t length (optional): length of the array

Returns

const char*: pointer to the correct string

Example

#include <Gamebuino-Meta.h>

const MultiLang[] lang_fox = {
  {LANG_EN, "fox"},
  {LANG_DE, "Fuchs"},
};

void setup() {
  gb.begin();
}

void loop() {
  if (gb.update()) {
    gb.display.clear();
    
    // fetch the pointer to the string
    const char* fox = gb.language.get(lang_fox);
    gb.display.println(fox);
  }
}