3👍
I’m not sure how flexible you are with your URL scheme, but how about this:
Use the standard django CMS i18n URL rules (so you end up with yoursite.com/ja/ and yoursite.com/en/).
Next create two pages: ‘au’ and ‘jp’. Redirect the homepage to one of the two pages (or write some smarter logic for that, for example in a middleware). Now keep your regional content in those two sub trees.
Simply don’t translate the pages in the ‘au’ subtree into Japanese if you don’t want.
1👍
You may make it, by writing your own copy of i18n_patterns
.
So by definition:
Language prefix in URL patterns
i18n_patterns(*urls, prefix_default_language=True)[source]
This function can be used in a root URLconf and Django will
automatically prepend the current active language code to all URL
patterns defined within i18n_patterns().
Here an example made inside template but same variables/objects you need in your implementation.
Reversing in templates
If localized URLs get reversed in templates they always use the
current language. To link to a URL in another language use the
language template tag. It enables the given language in the enclosed
template section:{% load i18n %} {% get_available_languages as languages %} {% trans "View this category in:" %} {% for lang_code, lang_name in languages %} {% language lang_code %} <a href="{% url 'category' slug=category.slug %}">{{ lang_name }}</a> {% endlanguage %} {% endfor %}
The language tag expects the language code as the only argument.
Reference: Django docs – i18n/translation
- [Django]-Image watermark using PIL in django
- [Django]-Django Import Issue
- [Django]-Django – How to redirect differently using LoginRequired and PermissionRequired?
- [Django]-Django logging: Cannot create logs per day