Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Translate.php « core - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 70f795245bda3d6d653a9941f91ce9b7717d392e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 */
namespace Piwik;

use Exception;
use Piwik\Container\StaticContainer;
use Piwik\Translation\Translator;

/**
 * @deprecated Use Piwik\Translation\Translator instead.
 * @see \Piwik\Translation\Translator
 */
class Translate
{
    /**
     * Clean a string that may contain HTML special chars, single/double quotes, HTML entities, leading/trailing whitespace
     *
     * @param string $s
     * @return string
     */
    public static function clean($s)
    {
        return html_entity_decode(trim($s), ENT_QUOTES, 'UTF-8');
    }

    public static function loadEnglishTranslation()
    {
    }

    public static function unloadEnglishTranslation()
    {
    }

    public static function reloadLanguage($language = false)
    {
    }

    /**
     * Reads the specified code translation file in memory.
     *
     * @param bool|string $language 2 letter language code. If not specified, will detect current user translation, or load default translation.
     * @return void
     */
    public static function loadCoreTranslation($language = false)
    {
    }

    public static function mergeTranslationArray($translation)
    {
    }

    /**
     * @return string the language filename prefix, eg 'en' for english
     * @throws exception if the language set is not a valid filename
     */
    public static function getLanguageToLoad()
    {
        return self::getTranslator()->getCurrentLanguage();
    }

    /** Reset the cached language to load. Used in tests. */
    public static function reset()
    {
        self::getTranslator()->setCurrentLanguage(null);
    }

    /**
     * Either the name of the currently loaded language such as 'en' or 'de' or null if no language is loaded at all.
     * @return bool|string
     */
    public static function getLanguageLoaded()
    {
        return self::getTranslator()->getCurrentLanguage();
    }

    public static function getLanguageDefault()
    {
        return self::getTranslator()->getDefaultLanguage();
    }

    /**
     * Generate javascript translations array
     */
    public static function getJavascriptTranslations()
    {
        return self::getTranslator()->getJavascriptTranslations();
    }

    public static function findTranslationKeyForTranslation($translation)
    {
        return self::getTranslator()->findTranslationKeyForTranslation($translation);
    }

    /**
     * @return Translator
     */
    private static function getTranslator()
    {
        return StaticContainer::getContainer()->get('Piwik\Translation\Translator');
    }
}