◆ __construct()
__construct |
( |
|
$base, |
|
|
|
$lang = null , |
|
|
|
$metadata = [] |
|
) |
| |
Initialize a new I18NString instance.
- Parameters
-
string | $base | Text in default content language. |
array | $lang | Text in additional languages. |
array | $metadata | Database info for id, table, field. |
◆ __toString()
Return the text representation of this i18n field in selected language. The language is selected by self::content_language (with precendence) or by $_SESSION['_language'].
- Returns
- string
◆ fetchDataForField()
static fetchDataForField |
( |
|
$object_id, |
|
|
|
$table, |
|
|
|
$field |
|
) |
| |
|
static |
Retrieves all translations of one field.
- Parameters
-
string | $object_id | The id of the object with i18n fields. |
string | $table | The name of the table with the original values. |
string | $field | The name of the i18n field. |
- Returns
- array An array with language as key and translation as value.
◆ fetchDataForRow()
static fetchDataForRow |
( |
|
$object_id, |
|
|
|
$table |
|
) |
| |
|
static |
Retrieves all translations of all fields for given object (by id) and table.
- Parameters
-
string | $object_id | The id of the object with i18n fields. |
string | $table | The name of the table with the original values. |
- Returns
- array An array with all translations of all fields grouped by field.
◆ getContentLanguage()
static getContentLanguage |
( |
| ) |
|
|
static |
Returns the language the contnet is translated into.
- Returns
- string The language the content is translated into.
◆ getDefaultLanguage()
static getDefaultLanguage |
( |
| ) |
|
|
static |
Returns the language all values are translated into by default. The language ist normally defined in $GLOBALS'CONTENT_LANGUAGES'.
- Returns
- string The default language all values are translated into.
◆ jsonSerialize()
Return the JSON representation of this i18n field in selected language.
◆ load()
static load |
( |
|
$object_id, |
|
|
|
$table, |
|
|
|
$field, |
|
|
|
$base = null |
|
) |
| |
|
static |
Returns an I18NString object by given object_id, table and field.
- Parameters
-
string | $object_id | The id of the object with i18n fields. |
string | $table | The name of the table with the original values. |
string | $field | The name of the i18n field. |
string | $base | Sets the original value or retrieve it from database if null. |
- Returns
- I18NString The I18NString object.
◆ localized()
Returns the string in the specified language (additional languages and default languages).
- Parameters
-
string | $lang | Additional language or default language. |
- Returns
- string The localized string.
◆ original()
Return the string in the default content language.
- Returns
- string String in default content language.
◆ removeAllTranslations()
static removeAllTranslations |
( |
|
$object_id, |
|
|
|
$table, |
|
|
|
$lang = null |
|
) |
| |
|
static |
Removes all translations by given object id and table name. Accepts the language as third parameter to remove only translations to this language.
- Parameters
-
string | $object_id | The id of the sorm object. |
string | $table | The table name. |
string | $lang | Optional name of language. |
- Returns
- int The number of deleted translations.
◆ removeTranslations()
Removes all translations for this I18NString object.
◆ setContentLanguage()
static setContentLanguage |
( |
|
$language | ) |
|
|
static |
Sets the language the content is translated into.
- Parameters
-
◆ setDefaultLanguage()
static setDefaultLanguage |
( |
|
$language = null | ) |
|
|
static |
Sets the default language the content is translated into. The default is normally defined by the first entry in $GLOBALS'CONTENT_LANGUAGES'.
- Parameters
-
◆ setLocalized()
setLocalized |
( |
|
$text, |
|
|
|
$lang |
|
) |
| |
Sets the translation for the given language. If the given language is the default language, sets the original.
- Parameters
-
type | $text | The translated or original value. |
type | $lang | The additional or default language. |
- Returns
- string The translated or original value.
- Exceptions
-
◆ setMetadata()
Sets the metadata (database info for id, table, field) of this i18n field.
- Parameters
-
array | $metadata | Database info for id, table, field. |
◆ setOriginal()
Sets the original (untranslated) value of this i18n field.
- Parameters
-
string | $text | The original value. |
- Returns
- string The original value.
◆ setTranslations()
Sets all translations of this i18n field.
- Parameters
-
array | $lang | An array with languages as keys and translations as values. |
- Returns
- array The array with translations.
◆ storeTranslations()
Stores the i18n String manually in the database
◆ toArray()
Return an array containing the text in all additional languages.
- Returns
- array The array with translations.
◆ translation()
Return the string in the specified additional language.
- Parameters
-
string | The additional language. |
- Returns
- string The translated value.
◆ trim()
trim |
( |
|
$symbols = " \t\n\r\0\x0B" | ) |
|
Trim all language strings
- Parameters
-
string | $symbols | All symbols to trim. |
- Returns
- I18NString Returns this.
◆ $base
◆ $content_language
◆ $default_language
◆ $lang
◆ $metadata
The documentation for this class was generated from the following file: