Q_Text Class
Methods for loading text from files. Used for translations, A/B testing and more.
Methods
get
-
name
-
[$options=array()]
Get the text from a specific text source or sources.
Parameters:
-
name
String | ArrayThe name of the text source. Can also be an array, in which case the text sources are merged in the order they are named.
-
[$options=array()]
Array optional-
[ignoreCache=false]
Boolean optionalIf true, reloads the text source even if it's been already cached.
-
[merge=false]
Boolean optionalFor Q_Text::set if content is loaded
-
[language=null]
String optionalOverride language
-
[locale=null]
String optionalOverride locale
-
Returns:
Returns the (merged) content of the text source(s)
params
-
$parts
-
[$options=array()]
Get parameters merged from all the text sources corresponding to a view template
Parameters:
-
$parts
ArrayThe parts of the view name, to use with Q/text config
-
[$options=array()]
Array optionalArray of options which will pass to Q_Text::get
Returns:
The merged parameters that come from the text
set
-
language
-
[locale=null]
Sets the language and locale to use in Q_Text::basename() calls. The Q_Dispatcher::dispatch() method calls this by default using information from Q_Request::languages().
Parameters:
-
language
StringSomething like "en"
-
[locale=null]
String optionalSomething like "US", but can also be null if unknown
set
-
name
-
content
-
[merge=false]
Sets the text for a specific text source.
Parameters:
-
name
StringThe name of the text source
-
content
ArrayThe content, a hierarchical object whose leaves are the actual text translated into the current language in Q.Text.language
-
[merge=false]
Boolean optionalIf true, merges on top instead of replacing
sources
-
$parts
Get sources for a view template merged from all the wildcards in the config
Parameters:
-
$parts
ArrayThe parts of the view name, to use with Q/text config
Returns:
The merged array of names of sources to load