Download the PHP package gelight/sml-i18n-for-php without Composer
On this page you can find all versions of the php package gelight/sml-i18n-for-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gelight/sml-i18n-for-php
More information about gelight/sml-i18n-for-php
Files in gelight/sml-i18n-for-php
Package sml-i18n-for-php
Short Description Internationalization and localization for PHP based on SML
License MIT
Informations about the package sml-i18n-for-php
# sml-i18n-for-php
Internationalization for PHP based on SML (Simple Markup Language)
What is SML?
Using
Example - How can I use this lib?
Example
Result:
Documentation
loadTranslations()
Loads all SML files with the correspondingly defined translations. The translations can then be fetched using the $i18n->t() method.
loadTranslations(string $path): smlI18n
getDefaultLocale()
Returns the default locale.
getDefaultLocale(): string
setDefaultLocale()
Set the default locale. The default locale is used as the last possible callback when translations of a language are not available.
setDefaultLocale(string $locale): smlI18n
isValidLocale()
Checks that the specified locale is valid.
isValidLocale(string $locale): bool
getCurrentLocale()
Returns the defined current locale.
getCurrentLocale(): string
setCurrentLocale()
Set the current locale.
setCurrentLocale(string $locale): smlI18n
setForcedCallbackLocale()
Defines a forced callback locale when translations of a language are not available.
Standard behavior for locale callbacks when:
- default language is - de
- current locale is - en_US
- en_US
- en
- de
setForcedCallbackLocale(string $locale): smlI18n
getForcedCallbackLocale()
Returns the defined forced callback locale. If not defined a forced callback locale the method will return "false".
getForcedCallbackLocale(): string|bool
t()
Returns the related translation value according to the specified key.
t(string $key, array $replaceWith = []): string
Using translation placeholders: