Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | List of all members
core_string_manager Interface Reference

Interface for string manager. More...

Inheritance diagram for core_string_manager:
core_string_manager_install core_string_manager_standard

Public Member Functions

 get_list_of_countries ($returnall=false, $lang=null)
 Returns a localised list of all country names, sorted by country keys. More...
 
 get_list_of_currencies ($lang=null)
 Returns localised list of currencies. More...
 
 get_list_of_languages ($lang=null, $standard='iso6392')
 Returns a localised list of languages, sorted by code keys. More...
 
 get_list_of_translations ($returnall=false)
 Returns localised list of installed translations. More...
 
 get_revision ()
 Returns string revision counter, this is incremented after any string cache reset. More...
 
 get_string ($identifier, $component='', $a=null, $lang=null)
 Get String returns a requested string. More...
 
 load_component_strings ($component, $lang, $disablecache=false, $disablelocal=false)
 Load all strings for one component. More...
 
 reset_caches ($phpunitreset=false)
 Invalidates all caches, should the implementation use any. More...
 
 string_deprecated ($identifier, $component)
 Has string been deprecated? More...
 
 string_exists ($identifier, $component)
 Does the string actually exist? More...
 
 translation_exists ($lang, $includeall=true)
 Checks if the translation exists for the language. More...
 

Detailed Description

Interface for string manager.

Interface describing class which is responsible for getting of localised strings from language packs.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_list_of_countries()

core_string_manager::get_list_of_countries (   $returnall = false,
  $lang = null 
)

Returns a localised list of all country names, sorted by country keys.

Parameters
bool$returnallreturn all or just enabled
string$langmoodle translation language, null means use current
Return values
arraytwo-letter country code => translated name.

Implemented in core_string_manager_install, and core_string_manager_standard.

◆ get_list_of_currencies()

core_string_manager::get_list_of_currencies (   $lang = null)

Returns localised list of currencies.

Parameters
string$langmoodle translation language, null means use current
Return values
arraycurrency code => localised currency name

Implemented in core_string_manager_install, and core_string_manager_standard.

◆ get_list_of_languages()

core_string_manager::get_list_of_languages (   $lang = null,
  $standard = 'iso6392' 
)

Returns a localised list of languages, sorted by code keys.

Parameters
string$langmoodle translation language, null means use current
string$standardlanguage list standard iso6392: three-letter language code (ISO 639-2/T) => translated name.
Return values
arraylanguage code => translated name

Implemented in core_string_manager_standard, and core_string_manager_install.

◆ get_list_of_translations()

core_string_manager::get_list_of_translations (   $returnall = false)

Returns localised list of installed translations.

Parameters
bool$returnallreturn all or just enabled
Return values
arraymoodle translation code => localised translation name

Implemented in core_string_manager_install, and core_string_manager_standard.

◆ get_revision()

core_string_manager::get_revision ( )

Returns string revision counter, this is incremented after any string cache reset.

Return values
intlang string revision counter, -1 if unknown

Implemented in core_string_manager_install, and core_string_manager_standard.

◆ get_string()

core_string_manager::get_string (   $identifier,
  $component = '',
  $a = null,
  $lang = null 
)

Get String returns a requested string.

Parameters
string$identifierThe identifier of the string to search for
string$componentThe module the string is associated with
string | object | array$aAn object, string or number that can be used within translation strings
string$langmoodle translation language, null means use current
Return values
stringThe String !

Implemented in core_string_manager_install, and core_string_manager_standard.

◆ load_component_strings()

core_string_manager::load_component_strings (   $component,
  $lang,
  $disablecache = false,
  $disablelocal = false 
)

Load all strings for one component.

Parameters
string$componentThe module the string is associated with
string$lang
bool$disablecacheDo not use caches, force fetching the strings from sources
bool$disablelocalDo not use customized strings in xx_local language packs
Return values
arrayof all string for given component and lang

Implemented in core_string_manager_install, and core_string_manager_standard.

◆ reset_caches()

core_string_manager::reset_caches (   $phpunitreset = false)

Invalidates all caches, should the implementation use any.

Parameters
bool$phpunitresettrue means called from our PHPUnit integration test reset

Implemented in core_string_manager_install, and core_string_manager_standard.

◆ string_deprecated()

core_string_manager::string_deprecated (   $identifier,
  $component 
)

Has string been deprecated?

Usually checked only inside get_string() to display debug warnings.

Parameters
string$identifierThe identifier of the string to search for
string$componentThe module the string is associated with
Return values
booltrue if deprecated

Implemented in core_string_manager_install, and core_string_manager_standard.

◆ string_exists()

core_string_manager::string_exists (   $identifier,
  $component 
)

Does the string actually exist?

get_string() is throwing debug warnings, sometimes we do not want them or we want to display better explanation of the problem.

Use with care!

Parameters
string$identifierThe identifier of the string to search for
string$componentThe module the string is associated with
Return values
booltrue if exists

Implemented in core_string_manager_install, and core_string_manager_standard.

◆ translation_exists()

core_string_manager::translation_exists (   $lang,
  $includeall = true 
)

Checks if the translation exists for the language.

Parameters
string$langmoodle translation language code
bool$includeallinclude also disabled translations
Return values
booltrue if exists

Implemented in core_string_manager_install, and core_string_manager_standard.


The documentation for this interface was generated from the following file: