Last active
March 3, 2022 02:04
-
-
Save hazho/5fd17fa7a5fa5e5eec1a47817c08d65a to your computer and use it in GitHub Desktop.
Multi-language(bidirection)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
{% load wagtailadmin_tags i18n navigation_tags site_tags wagtailcore_tags %} | |
{% wagtail_site as current_site %} | |
{% get_current_language as LANGUAGE_CODE %} | |
{% get_current_language_bidi as LANGUAGE_BIDI %} | |
<html class="no-js" lang="{{ LANGUAGE_CODE }}" dir="{% if LANGUAGE_BIDI %}rtl{% else %}ltr{% endif %}"> | |
<head> | |
<!-- option1 --> | |
<!-- if you like the language control all UI Use this --> | |
<style> | |
:root { | |
{% if LANGUAGE_CODE == "ar" %}font-size:14px;unicode-bidi: plaintext; {% else %} font-size:16px; {% endif %} | |
} | |
nav {width: 17.5rem; min-width: 17.5rem; max-width: 17.5rem} | |
{% block extra_style %}{% endblock extra_style %} | |
</style> | |
<!-- option2 --> | |
<!-- if you like the language control the certain elements/sections Use this --> | |
<style> | |
:root { | |
{% if LANGUAGE_CODE == "ar" %}unicode-bidi: plaintext;{% endif %} | |
font-size:16px; | |
} | |
nav { | |
{% if LANGUAGE_CODE == "ar" %} | |
width: 16.5rem; min-width: 16.5rem; max-width: 16.5rem | |
{% else %} | |
width: 17.5rem; min-width: 17.5rem; max-width: 17.5rem | |
{% endif %} | |
} | |
{% block extra_style %}{% endblock extra_style %} | |
</style> | |
... | |
</head> | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
WAGTAIL_I18N_ENABLED = True | |
LANGUAGES = WAGTAILADMIN_PERMITTED_LANGUAGES = WAGTAIL_CONTENT_LANGUAGES = WAGTAILFRONTENDCACHE_LANGUAGES = [ | |
('en', 'English'), | |
('ar', 'Arabic') | |
] | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment