1 | <?php |
||
27 | trait LocalizedString |
||
28 | { |
||
29 | /** @} */ |
||
30 | |||
31 | abstract public function getLanguageRedis(string $default_language = 'en', int $expiring_time = 86400) : string; |
||
32 | |||
33 | abstract public function loadCurrentLocalization(string $dir = '') : bool; |
||
34 | |||
35 | /** |
||
36 | * \addtogroup Localization Localization |
||
37 | * @{ |
||
38 | */ |
||
39 | |||
40 | /** @internal |
||
41 | * \brief Reference to the bot. */ |
||
42 | protected $bot; |
||
43 | |||
44 | /** @internal |
||
45 | * \brief Current user/group language. */ |
||
46 | public $language; |
||
47 | |||
48 | /** @internal |
||
49 | * \brief Store the localizated strings. */ |
||
50 | protected $local; |
||
51 | |||
52 | /** |
||
53 | * \brief Get a localized string giving an index. |
||
54 | * \details Using LocalizedString::language this method get the string of the index given localized string in language of the current user/group. |
||
55 | * This method will load the language first, using PhpBotFramework\Localization\Language::getLanguage(), if the language has not been set. |
||
56 | * If the localization file for the user/group language has not been load yet, it will load it (load only the single localization file if the bot is using webhook, load all otherwise). |
||
57 | * @param string $index Index of the localized string to get. |
||
58 | * @return string Localized string in the current user/group language. |
||
59 | */ |
||
60 | public function getStr($index) |
||
75 | |||
76 | /** @} */ |
||
77 | } |
||
78 |