class Loader (View source)

Methods

static Loader
getInstance()

Returns the singleton Loader object.

static void
loadFunctions()

Loads global localization functions.

static array
listLocales(string $locale)

Figure out all possible locale names and start with the most specific ones. I.e. for sr_CS.UTF-8@latin, look through all of sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr.

static void
setCacheFactory(CacheFactoryInterface|null $cacheFactory)

Sets factory responsible for composing a CacheInterface

getTranslator(string $domain = '')

Returns Translator object for domain or for default domain.

void
bindtextdomain(string $domain, string $path)

Sets the path for a domain.

void
textdomain(string $domain)

Sets the default domain.

string
setlocale(string $locale)

Sets a requested locale.

string
detectlocale()

Detects currently configured locale.

Details

static Loader getInstance()

Returns the singleton Loader object.

Return Value

Loader object

static void loadFunctions()

Loads global localization functions.

Return Value

void

static array listLocales(string $locale)

Figure out all possible locale names and start with the most specific ones. I.e. for sr_CS.UTF-8@latin, look through all of sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr.

Parameters

string $locale

Locale code

Return Value

array

list of locales to try for any POSIX-style locale specification

static void setCacheFactory(CacheFactoryInterface|null $cacheFactory)

Sets factory responsible for composing a CacheInterface

Parameters

CacheFactoryInterface|null $cacheFactory

Return Value

void

Translator getTranslator(string $domain = '')

Returns Translator object for domain or for default domain.

Parameters

string $domain

Translation domain

Return Value

Translator

void bindtextdomain(string $domain, string $path)

Sets the path for a domain.

Parameters

string $domain

Domain name

string $path

Path where to find locales

Return Value

void

void textdomain(string $domain)

Sets the default domain.

Parameters

string $domain

Domain name

Return Value

void

string setlocale(string $locale)

Sets a requested locale.

Parameters

string $locale

Locale name

Return Value

string

Set or current locale

string detectlocale()

Detects currently configured locale.

It checks:

  • global lang variable
  • environment for LC_ALL, LC_MESSAGES and LANG

Return Value

string

with locale name