Created
December 7, 2016 09:58
-
-
Save DominikStyp/02ea17cbb44825313833964dd6e69d9f to your computer and use it in GitHub Desktop.
Przykład na modyfikacje funkcji trans()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function trans($key){ | |
static $translates = [ | |
'months_1' => 'Styczeń', | |
'months_2' => 'Luty', | |
'months_3' => 'Marzec', | |
'months_4' => 'Kwiecień', | |
'months_5' => 'Maj', | |
'months_6' => 'Czerwiec', | |
'months_7' => 'Lipiec', | |
'months_8' => 'Sierpień', | |
'months_9' => 'Wrzesień', | |
'months_10' => 'Październik', | |
'months_11' => 'Listopad', | |
'months_12' => 'Grudzień', | |
'writtenChars' => 'Napisano #chars znaków', | |
]; | |
return $translates[$key]; | |
} | |
?> | |
<script> | |
var translateJS = { | |
months: [ "<?=trans('month_1')?>", | |
"<?=trans('month_2')?>", | |
"<?=trans('month_3')?>", | |
"<?=trans('month_4')?>", | |
"<?=trans('month_5')?>", | |
"<?=trans('month_6')?>", | |
"<?=trans('month_7')?>", | |
"<?=trans('month_8')?>", | |
"<?=trans('month_9')?>", | |
"<?=trans('month_10')?>", | |
"<?=trans('month_11')?>" | |
"<?=trans('month_12')?>" ], | |
writtenChars: "<?=trans('writtenChars'?>" | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment