mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-11-20 21:46:04 -05:00
feat: translations support
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block headtitle %}About - {{PORTAL_NAME}}{% endblock headtitle %}
|
||||
|
||||
{% block headermeta %}
|
||||
|
||||
{% load custom_filters %}
|
||||
<meta property="og:title" content="About - {{PORTAL_NAME}}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="">
|
||||
@@ -38,10 +39,13 @@
|
||||
{% endblock headermeta %}
|
||||
|
||||
{% block innercontent %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
|
||||
<div class="custom-page-wrapper">
|
||||
<h2>About</h2>
|
||||
<h2>{{ "About" | custom_translate:LANGUAGE_CODE}}</h2>
|
||||
<hr/>
|
||||
|
||||
<p><a href="https://mediacms.io">MediaCMS</a> is a modern, fully featured open source video and media CMS. It is developed to meet the needs of modern web platforms for viewing and sharing media.</p>
|
||||
|
||||
<p><a href="https://mediacms.io">MediaCMS</a> {{ "is a modern, fully featured open source video and media CMS. It is developed to meet the needs of modern web platforms for viewing and sharing media" | custom_translate:LANGUAGE_CODE}}.</p>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
68
templates/cms/set_language.html
Normal file
68
templates/cms/set_language.html
Normal file
@@ -0,0 +1,68 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% load custom_filters %}
|
||||
|
||||
{% block headtitle %}About - {{PORTAL_NAME}}{% endblock headtitle %}
|
||||
|
||||
{% block headermeta %}
|
||||
|
||||
<meta property="og:title" content="About - {{PORTAL_NAME}}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="">
|
||||
|
||||
<meta name="twitter:card" content="summary">
|
||||
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "BreadcrumbList",
|
||||
"itemListElement": [{
|
||||
"@type": "ListItem",
|
||||
"position": 1,
|
||||
"name": "{{PORTAL_NAME}}",
|
||||
"item": {
|
||||
"@type": "WebPage",
|
||||
"@id": "{{FRONTEND_HOST}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"@type": "ListItem",
|
||||
"position": 2,
|
||||
"name": "About",
|
||||
"item": {
|
||||
"@type": "AboutPage",
|
||||
"@id": "{{FRONTEND_HOST}}/about"
|
||||
}
|
||||
}]
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock headermeta %}
|
||||
|
||||
{% block innercontent %}
|
||||
<div class="custom-page-wrapper">
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
|
||||
<h1>{{"Change Language"| custom_translate:LANGUAGE_CODE}}</h1>
|
||||
<hr/>
|
||||
<h2>{{"Select"| custom_translate:LANGUAGE_CODE}}</h2>
|
||||
|
||||
<p>
|
||||
<form action="{% url 'set_language' %}" method="post">{% csrf_token %}
|
||||
<input name="next" type="hidden" value="/">
|
||||
<select name="language">
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
{% get_available_languages as LANGUAGES %}
|
||||
{% get_language_info_list for LANGUAGES as languages %}
|
||||
{% for language in languages %}
|
||||
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
|
||||
{{ language.name_local }} ({{ language.code }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="submit" value={{"Go"| custom_translate:LANGUAGE_CODE}}>
|
||||
</form>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -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>
|
||||
|
||||
14
templates/config/installation/translations.html
Normal file
14
templates/config/installation/translations.html
Normal 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 }};;
|
||||
Reference in New Issue
Block a user