Commit 2991b9e1 authored by Thomas Citharel's avatar Thomas Citharel
Browse files

Merge branch 'fix-datepicker-locale-path' into 'develop'

Fix datepicker locale path

Closes #279

See merge request framasoft/framadate!242
parents 5b5330ce 3705e6c4
......@@ -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';
}
......@@ -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,9 +26,9 @@
</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>
</div>
</div>
\ No newline at end of file
</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment