Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Language

[15:7] extends: FxObj

Wraps FXGL's Language, a small value type that pairs an English language name with an optional native-script name. FXGL ships 33 predefined Language constants (ARABIC, CHINESE, ENGLISH, FRENCH, GERMAN, ... VIETNAMESE) plus NONE; the Language.get helper resolves them by name. Pass these to LocalizationService.setSelectedLanguage to switch the active translation.

Methods

  • Language (string Name = null, string NativeName = null)

    Creates or resolves a Language. When NativeName is omitted the constructor first tries to resolve a predefined FXGL Language constant (ENGLISH, FRENCH, GERMAN, ...) by name. When that fails (custom language not in the predefined set) it constructs a new one. Pass a NativeName to force a fresh Language with the given native-script label.

    • @p Name is the English language name (e.g. "ENGLISH", "FRENCH").
    • @p NativeName is the language name in its native script. Optional.
  • getName ()

    Returns the English language name.

    • @r A string with the name.
  • getNativeName ()

    Returns the native-script language name.

    • @r A string with the native name.