These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
0 ignored issues
–
show
Coding Style
Documentation
introduced
by
Loading history...
|
|||
3 | * Smarty {translation key="snippet.key"} function plugin * |
||
4 | * |
||
5 | * @param $params |
||
0 ignored issues
–
show
|
|||
6 | * @param $smarty |
||
0 ignored issues
–
show
|
|||
7 | * @return string |
||
8 | */ |
||
9 | function smarty_function_translation($params) |
||
0 ignored issues
–
show
|
|||
10 | { |
||
11 | global $opt; |
||
12 | |||
13 | if (!isset($params['key'])) { |
||
14 | return ''; |
||
15 | } |
||
16 | |||
17 | $translation = AppKernel::Container()->get(OcLegacy\Translation\TranslationService::class); |
||
18 | $translation->setLocale(strtolower($opt['template']['locale'])); |
||
19 | |||
20 | return $translation->trans($params['key']); |
||
21 | } |
||
22 |