Fix datepicker locale path
Closes #279 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
0e022f51c1
commit
ea3e391b87
@ -75,3 +75,30 @@ 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];
|
||||
} else {
|
||||
return $locale;
|
||||
}
|
||||
}
|
||||
|
||||
function path_for_datepicker_locale($lang) {
|
||||
return __DIR__ . '/../../js/locales/bootstrap-datepicker.' . $lang . '.js';
|
||||
}
|
||||
|
@ -23,8 +23,8 @@
|
||||
<script type="text/javascript" src="{'js/jquery-1.12.4.min.js'|resource}"></script>
|
||||
<script type="text/javascript" src="{'js/bootstrap.min.js'|resource}"></script>
|
||||
<script type="text/javascript" src="{'js/bootstrap-datepicker.js'|resource}"></script>
|
||||
{if "en" != $locale}
|
||||
<script type="text/javascript" src="{"js/locales/bootstrap-datepicker.$locale.js"|resource}"></script>
|
||||
{if 'en' != $locale}
|
||||
<script type="text/javascript" src="{$locale|datepicker_path|resource}"></script>
|
||||
{/if}
|
||||
<script type="text/javascript" src="{'js/core.js'|resource}"></script>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
</p>
|
||||
<p>
|
||||
{__('Step 1', 'More informations here:')}
|
||||
<a href="http://{$locale}.wikipedia.org/wiki/Markdown">http://{$locale}.wikipedia.org/wiki/Markdown</a>
|
||||
<a href="http://{$locale|locale_2_lang}.wikipedia.org/wiki/Markdown">http://{$locale|locale_2_lang}.wikipedia.org/wiki/Markdown</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user