Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
Standard string manager.
Copyright: | 2010 Petr Skoda {@link http://skodak.org} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 716 lines (30 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
core_string_manager_standard:: (17 methods):
__construct()
get_language_dependencies()
load_component_strings()
load_deprecated_strings()
string_deprecated()
string_exists()
get_string()
get_performance_summary()
get_list_of_countries()
get_list_of_languages()
translation_exists()
get_list_of_translations()
get_list_of_currencies()
reset_caches()
get_key_suffix()
get_revision()
populate_parent_languages()
Class: core_string_manager_standard - X-Ref
Standard string_manager implementation__construct($otherroot, $localroot, $translist, $transaliases = []) X-Ref |
Create new instance of string manager param: string $otherroot location of downloaded lang packs - usually $CFG->dataroot/lang param: string $localroot usually the same as $otherroot param: array $translist limit list of visible translations param: array $transaliases aliases to use for the languages in the language selector |
get_language_dependencies($lang) X-Ref |
Returns list of all explicit parent languages for the given language. English (en) is considered as the top implicit parent of all language packs and is not included in the returned list. The language itself is appended to the end of the list. The method is aware of circular dependency risk. return: array all explicit parent languages with the lang itself appended param: string $lang the code of the language |
load_component_strings($component, $lang, $disablecache = false, $disablelocal = false) X-Ref |
Load all strings for one component return: array of all string for given component and lang param: string $component The module the string is associated with param: string $lang param: bool $disablecache Do not use caches, force fetching the strings from sources param: bool $disablelocal Do not use customized strings in xx_local language packs |
load_deprecated_strings() X-Ref |
Parses all deprecated.txt in all plugins lang locations and returns the list of deprecated strings. Static variable is used for caching, this function is only called in dev environment. return: array of deprecated strings in the same format they appear in deprecated.txt files: "identifier,component" |
string_deprecated($identifier, $component) X-Ref |
Has string been deprecated? Usually checked only inside get_string() to display debug warnings. return: bool true if deprecated param: string $identifier The identifier of the string to search for param: string $component The module the string is associated with |
string_exists($identifier, $component) X-Ref |
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. Note: Use with care! return: boot true if exists param: string $identifier The identifier of the string to search for param: string $component The module the string is associated with |
get_string($identifier, $component = '', $a = null, $lang = null) X-Ref |
Get String returns a requested string return: string The String ! param: string $identifier The identifier of the string to search for param: string $component The module the string is associated with param: string|object|array $a An object, string or number that can be used param: string $lang moodle translation language, null means use current |
get_performance_summary() X-Ref |
Returns information about the core_string_manager performance. return: array |
get_list_of_countries($returnall = false, $lang = null) X-Ref |
Returns a localised list of all country names, sorted by localised name. return: array two-letter country code => translated name. param: bool $returnall return all or just enabled param: string $lang moodle translation language, null means use current |
get_list_of_languages($lang = null, $standard = 'iso6391') X-Ref |
Returns a localised list of languages, sorted by code keys. return: array language code => translated name param: string $lang moodle translation language, null means use current param: string $standard language list standard |
translation_exists($lang, $includeall = true) X-Ref |
Checks if the translation exists for the language return: bool true if exists param: string $lang moodle translation language code param: bool $includeall include also disabled translations |
get_list_of_translations($returnall = false) X-Ref |
Returns localised list of installed translations return: array moodle translation code => localised translation name param: bool $returnall return all or just enabled |
get_list_of_currencies($lang = null) X-Ref |
Returns localised list of currencies. return: array currency code => localised currency name param: string $lang moodle translation language, null means use current |
reset_caches($phpunitreset = false) X-Ref |
Clears both in-memory and on-disk caches param: bool $phpunitreset true means called from our PHPUnit integration test reset |
get_key_suffix() X-Ref |
Returns cache key suffix, this enables us to store string + lang menu caches in local caches on cluster nodes. We can not use prefix because it would cause problems when creating subdirs in cache file store. return: string |
get_revision() X-Ref |
Returns string revision counter, this is incremented after any string cache reset. return: int lang string revision counter, -1 if unknown |
populate_parent_languages($lang, array $stack = array() X-Ref |
Helper method that recursively loads all parents of the given language. return: array list of all parents of the given language with the $lang itself added as the last element param: string $lang language code param: array $stack list of parent languages already populated in previous recursive calls |