feat: translations support

This commit is contained in:
Markos Gogoulos
2024-10-04 13:17:40 +03:00
committed by GitHub
parent ef4067cbdd
commit 4992cc425c
84 changed files with 2303 additions and 161 deletions

View File

@@ -1,10 +1,11 @@
<script type="text/javascript">
var MediaCMS = {
{% if media %}mediaId: "{{media}}", {% endif %}
{% if user %}profileId: "{{user.username}}", {% endif %}
};
{% include "config/core/api.html" %}
{% include "config/core/url.html" %}
{% include "config/core/user.html" %}
@@ -14,6 +15,8 @@
{% include "config/installation/pages.html" %}
{% include "config/installation/site.html" %}
{% include "config/installation/translations.html" %}
window.MediaCMS = MediaCMS;
</script>

View File

@@ -0,0 +1,14 @@
// These are the translations that will be used in frontend/src using the helper function
// translateString (frontend/src/static/js/utils/helpers/translate.js)
// They are fetched from the backend, and specifically files/frontend_translations
// The Django backend is passing dictionary FRONTEND_TRANSLATIONS.
// This contains key values where keys do not have a space
// TRANSLATIONS object will be availaible as window.TRANSLATIONS
// IMPORTANT: If you are starting the frontend app (localhost:8088), you are not getting at this
// POINT, so there are not translations. Translations can only be available and tested on the Django app
// and templates, that are loading React as well
window.TRANSLATION = {{ TRANSLATION|safe }};;
window.REPLACEMENTS = {{ REPLACEMENTS|safe }};;