I18n::get_i18n_strings( array $strings, array $languages, array $domains = array(), string $default_language = 'en_US', int $flags = 7 )
Get all possible translations for a String based on the given Languages and Domains
Contents
WARNING: This function is slow because it deals with files, so don’t overuse it!
Parameters
- $strings
-
(array) (Required) An array of strings (required).
- $languages
-
(array) (Required) Which l10n to fetch the string (required).
- $domains
-
(array) (Optional) Possible Domains to re-load.
Default value: array()
- $default_language
-
(string) (Optional) The default language to avoid re-doing that.
Default value: 'en_US'
- $flags
-
(int) (Optional) An integer resulting from the combination of compilation flags; defaults to
static::COMPILE_ALLto compile all versions of the translations.static::COMPILE_INPUTwill compile the translation for the string, as input.static::COMPILE_STRTOLOWERwill compile the translation for the string in its lowercase version.static::COMPILE_UCFIRSTwill compile the translation for the string in its title version.Default value: 7
Return
(TribeEventsarray<array<string>>) A multi level array with the possible translations for the given strings
Source
File: src/Tribe/I18n.php
public function get_i18n_strings( $strings, $languages, $domains = array(), $default_language = 'en_US' ) {
$domains = wp_parse_args(
$domains,
[
// The `default` domain doesn't need file path.
'default' => true,
'the-events-calendar' => $this->tec->plugin_dir . 'lang/',
]
);
return $this->get_i18n_strings_for_domains( $strings, $languages, $domains );
}
Changelog
| Version | Description |
|---|---|
| 5.1.5 | Add support for the $flags argument. |
| 5.1.1 | Introduced. |