class Translator

Properties

static array $translations

Methods

static 
init()

Initializes the translations by loading locale files from modules.

static 
find_translations(string $path)

Recursively loads locale files from a given path.

static string
translate(string $string, array $placeholders = [])

Translates a string using loaded translations and replaces placeholders.

Details

at line 16
static init()

Initializes the translations by loading locale files from modules.

at line 29
static find_translations(string $path)

Recursively loads locale files from a given path.

Parameters

string $path

The directory or file path to search for locale files.

at line 60
static string translate(string $string, array $placeholders = [])

Translates a string using loaded translations and replaces placeholders.

Parameters

string $string

The string to translate.

array $placeholders

Key-value pairs for placeholder replacement.

Return Value

string

The translated string.