Skip to content

ax.localization

Source: gamemode/framework/libraries/sh_localization.lua

Localization system for multi-language support.

Documented functions: 3

Functions


ax.localization:AddPhrase(lang, phrase, translation)

Adds or updates a single phrase translation for a language.

Realm: shared

Parameters

Name Type Description
lang string The language code (e.g., "en", "es", "fr")
phrase string The phrase key to add/update
translation string The translated string

Usage

ax.localization:AddPhrase("en", "welcome", "Welcome")

ax.localization:GetPhrase(phrase, ...)

Get a localized phrase in the client's language. Looks up a phrase key and returns the translation for the current language. Falls back to the phrase key if no translation is found.

Realm: shared

Parameters

Name Type Description
phrase string The phrase key to look up
... any Optional format arguments for string.format

Returns

  • string: The translated phrase or the original phrase key if not found

Usage

local greeting = ax.localization:GetPhrase("hello")
local msg = ax.localization:GetPhrase("welcome_player", playerName)

ax.localization:Register(name, translation)

Register a localization language with translation table. Adds or merges translation strings for a specific language code.

Realm: shared

Parameters

Name Type Description
name string The language code (e.g., "en", "es", "fr")
translation table Table of phrase keys to translated strings

Usage

ax.localization:Register("en", { hello = "Hello", goodbye = "Goodbye" })