diff --git a/app/inc/smarty.php b/app/inc/smarty.php index 90afe4b..96f57ac 100644 --- a/app/inc/smarty.php +++ b/app/inc/smarty.php @@ -75,3 +75,29 @@ function smarty_modifier_addslashes_single_quote($string) { function smarty_modifier_html($html) { return Utils::htmlEscape($html); } + +function smarty_modifier_datepicker_path($lang) { + $i = 0; + while (!is_file(path_for_datepicker_locale($lang)) && $i < 3) { + $lang_arr = explode('-', $lang); + if ($lang_arr && count($lang_arr) > 1) { + $lang = $lang_arr[0]; + } else { + $lang = 'en'; + } + $i += 1; + } + return 'js/locales/bootstrap-datepicker.' . $lang . '.js'; +} + +function smarty_modifier_locale_2_lang($locale) { + $lang_arr = explode('-', $locale); + if ($lang_arr && count($lang_arr) > 1) { + return $lang_arr[0]; + } + return $locale; +} + +function path_for_datepicker_locale($lang) { + return __DIR__ . '/../../js/locales/bootstrap-datepicker.' . $lang . '.js'; +} diff --git a/tpl/page.tpl b/tpl/page.tpl index e307e59..f04705d 100644 --- a/tpl/page.tpl +++ b/tpl/page.tpl @@ -23,8 +23,8 @@ - {if "en" != $locale} - + {if 'en' != $locale} + {/if} diff --git a/tpl/part/description_markdown.tpl b/tpl/part/description_markdown.tpl index e2bb823..7a407df 100644 --- a/tpl/part/description_markdown.tpl +++ b/tpl/part/description_markdown.tpl @@ -26,9 +26,9 @@
{__('Step 1', 'More informations here:')} - http://{$locale}.wikipedia.org/wiki/Markdown + http://{$locale|locale_2_lang}.wikipedia.org/wiki/Markdown
- \ No newline at end of file +