source: moodle/trunk/fuentes/lib/classes/string_manager.php @ 1331

Last change on this file since 1331 was 136, checked in by mabarracus, 4 years ago

Ported code to xenial

File size: 5.2 KB
Line 
1<?php
2// This file is part of Moodle - http://moodle.org/
3//
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.
8//
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.
13//
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/>.
16
17/**
18 * String manager interface.
19 *
20 * @package    core
21 * @copyright  2010 Petr Skoda {@link http://skodak.org}
22 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25defined('MOODLE_INTERNAL') || die();
26
27/**
28 * Interface for string manager
29 *
30 * Interface describing class which is responsible for getting
31 * of localised strings from language packs.
32 *
33 * @package    core
34 * @copyright  2010 Petr Skoda {@link http://skodak.org}
35 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36 */
37interface core_string_manager {
38    /**
39     * Get String returns a requested string
40     *
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 !
47     */
48    public function get_string($identifier, $component = '', $a = null, $lang = null);
49
50    /**
51     * Does the string actually exist?
52     *
53     * get_string() is throwing debug warnings, sometimes we do not want them
54     * or we want to display better explanation of the problem.
55     *
56     * Use with care!
57     *
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
61     */
62    public function string_exists($identifier, $component);
63
64    /**
65     * Has string been deprecated?
66     *
67     * Usually checked only inside get_string() to display debug warnings.
68     *
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
72     */
73    public function string_deprecated($identifier, $component);
74
75    /**
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.
80     */
81    public function get_list_of_countries($returnall = false, $lang = null);
82
83    /**
84     * Returns a localised list of languages, sorted by code keys.
85     *
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
90     */
91    public function get_list_of_languages($lang = null, $standard = 'iso6392');
92
93    /**
94     * Checks if the translation exists for the language
95     *
96     * @param string $lang moodle translation language code
97     * @param bool $includeall include also disabled translations
98     * @return bool true if exists
99     */
100    public function translation_exists($lang, $includeall = true);
101
102    /**
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
106     */
107    public function get_list_of_translations($returnall = false);
108
109    /**
110     * Returns localised list of currencies.
111     *
112     * @param string $lang moodle translation language, null means use current
113     * @return array currency code => localised currency name
114     */
115    public function get_list_of_currencies($lang = null);
116
117    /**
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
124     */
125    public function load_component_strings($component, $lang, $disablecache=false, $disablelocal=false);
126
127    /**
128     * Invalidates all caches, should the implementation use any
129     * @param bool $phpunitreset true means called from our PHPUnit integration test reset
130     */
131    public function reset_caches($phpunitreset = false);
132
133    /**
134     * Returns string revision counter, this is incremented after any
135     * string cache reset.
136     * @return int lang string revision counter, -1 if unknown
137     */
138    public function get_revision();
139}
140
Note: See TracBrowser for help on using the repository browser.