2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * String manager interface.
21 * @copyright 2010 Petr Skoda {@link http://skodak.org}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') ||
die();
28 * Interface for string manager
30 * Interface describing class which is responsible for getting
31 * of localised strings from language packs.
34 * @copyright 2010 Petr Skoda {@link http://skodak.org}
35 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37 interface core_string_manager
{
39 * Get String returns a requested string
41 * @param string $identifier The identifier of the string to search for
42 * @param string $component The module the string is associated with
43 * @param string|object|array $a An object, string or number that can be used
44 * within translation strings
45 * @param string $lang moodle translation language, null means use current
46 * @return string The String !
48 public function get_string($identifier, $component = '', $a = null, $lang = null);
51 * Does the string actually exist?
53 * get_string() is throwing debug warnings, sometimes we do not want them
54 * or we want to display better explanation of the problem.
58 * @param string $identifier The identifier of the string to search for
59 * @param string $component The module the string is associated with
60 * @return bool true if exists
62 public function string_exists($identifier, $component);
65 * Has string been deprecated?
67 * Usually checked only inside get_string() to display debug warnings.
69 * @param string $identifier The identifier of the string to search for
70 * @param string $component The module the string is associated with
71 * @return bool true if deprecated
73 public function string_deprecated($identifier, $component);
76 * Returns a localised list of all country names, sorted by country keys.
77 * @param bool $returnall return all or just enabled
78 * @param string $lang moodle translation language, null means use current
79 * @return array two-letter country code => translated name.
81 public function get_list_of_countries($returnall = false, $lang = null);
84 * Returns a localised list of languages, sorted by code keys.
86 * @param string $lang moodle translation language, null means use current
87 * @param string $standard language list standard
88 * iso6392: three-letter language code (ISO 639-2/T) => translated name.
89 * @return array language code => translated name
91 public function get_list_of_languages($lang = null, $standard = 'iso6392');
94 * Checks if the translation exists for the language
96 * @param string $lang moodle translation language code
97 * @param bool $includeall include also disabled translations
98 * @return bool true if exists
100 public function translation_exists($lang, $includeall = true);
103 * Returns localised list of installed translations
104 * @param bool $returnall return all or just enabled
105 * @return array moodle translation code => localised translation name
107 public function get_list_of_translations($returnall = false);
110 * Returns localised list of currencies.
112 * @param string $lang moodle translation language, null means use current
113 * @return array currency code => localised currency name
115 public function get_list_of_currencies($lang = null);
118 * Load all strings for one component
119 * @param string $component The module the string is associated with
120 * @param string $lang
121 * @param bool $disablecache Do not use caches, force fetching the strings from sources
122 * @param bool $disablelocal Do not use customized strings in xx_local language packs
123 * @return array of all string for given component and lang
125 public function load_component_strings($component, $lang, $disablecache=false, $disablelocal=false);
128 * Invalidates all caches, should the implementation use any
129 * @param bool $phpunitreset true means called from our PHPUnit integration test reset
131 public function reset_caches($phpunitreset = false);
134 * Returns string revision counter, this is incremented after any
135 * string cache reset.
136 * @return int lang string revision counter, -1 if unknown
138 public function get_revision();