Show:

Q_Text Class

Module: Q

Methods for loading text from files. Used for translations, A/B testing and more.

Item Index

Methods

Methods

get

(
  • name
  • [$options=array()]
)
Array static

Get the text from a specific text source or sources.

Parameters:

  • name String | Array

    The 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 optional

      If true, reloads the text source even if it's been already cached.

    • [merge=false] Boolean optional

      For Q_Text::set if content is loaded

    • [language=null] String optional

      Override language

    • [locale=null] String optional

      Override locale

Returns:

Array:

Returns the (merged) content of the text source(s)

params

(
  • $parts
  • [$options=array()]
)
Array static

Get parameters merged from all the text sources corresponding to a view template

Parameters:

  • $parts Array

    The parts of the view name, to use with Q/text config

  • [$options=array()] Array optional

    Array of options which will pass to Q_Text::get

Returns:

Array:

The merged parameters that come from the text

set

(
  • language
  • [locale=null]
)
static

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 String

    Something like "en"

  • [locale=null] String optional

    Something like "US", but can also be null if unknown

set

(
  • name
  • content
  • [merge=false]
)
static

Sets the text for a specific text source.

Parameters:

  • name String

    The name of the text source

  • content Array

    The content, a hierarchical object whose leaves are the actual text translated into the current language in Q.Text.language

  • [merge=false] Boolean optional

    If true, merges on top instead of replacing

sources

(
  • $parts
)
Array static

Get sources for a view template merged from all the wildcards in the config

Parameters:

  • $parts Array

    The parts of the view name, to use with Q/text config

Returns:

Array:

The merged array of names of sources to load