[ADD] Locale mapping for DataTables and Moment.JS

This commit is contained in:
Peter Pfeufer
2025-01-20 04:35:10 +01:00
parent 1b6cf98885
commit 856e939c21
39 changed files with 4459 additions and 22 deletions

View File

@@ -1,19 +1,12 @@
{% load i18n %}
{% load aa_i18n %}
<!-- Start Moment.js from cdnjs -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js" integrity="sha512-+H4iLjY3JsKiF2V6N366in5IQHj2uEsGV7Pp/GRcm0fn76aPAk5V8xB6n8fQhhSonTqTXs/klFz4D0GIn6Br9g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
{% if locale and LANGUAGE_CODE != 'en' %}
<!-- Moment.JS Not EN-en -->
{% get_current_language as LANGUAGE_CODE %}
{% get_language_info for LANGUAGE_CODE as lang %}
<!-- Moment.JS Not EN-en ({{ LANGUAGE_CODE }}) -->
{% get_momentjs_language_static LANGUAGE_CODE as MOMENTJS_LANG_PATH %}
{% if lang.code == 'zh-hans' %}
<!-- Moment.JS Localisation ({{ lang.code }}) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/locale/zh-cn.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
{% else %}
<!-- Moment.JS Localisation ({{ lang.code }}) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/locale/{{ lang.code }}.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
{% endif %}
<script src="{{ MOMENTJS_LANG_PATH }}" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
{% endif %}
<!-- End Moment JS from cdnjs -->