So, since you didn’t post your code, I’ll put a super basic based on Django 2.0.x
In your file settings.py
, you need to define the following values:
LANGUAGE_CODE = 'en'
USE_I18N = True
LANGUAGES = [
('en', 'English'),
('pt-br', 'Português'),
]
TEMPLATES = [
{
# outras definições
'OPTIONS': {
'context_processors': [
# outras definições
'django.template.context_processors.i18n',
],
},
},
]
MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
]
Now, in your file urls.py
must contain:
urlpatterns = [
# todas as suas urls aqui que NÃO precisam do prefixo do prefixo de idioma
url(r'^i18n/', include('django.conf.urls.i18n')),
]
urlpatterns += i18n_patterns(
# AQUI entram suas urls que precisam do prefixo de idioma
)
This is the super basic. I hope it fits.
I don’t understand very well what you need, you already have the sites and need to make them work or want to know how to make multilingual sites?
– Marcelo
I have site already in Portuguese, I need to make it has its English version and receive at the end of the url /en
– Rogerelite
Boy this theme is a bit extensive to deal with here, but to start search google about htaccess that makes the pages and index.php (if using php, of course) you must make the proper implementations of includes and Translators, you can use two compositions of pages each with your language or you can use tools like php-gettext and so on...
– Marcelo
Ha, sorry I didn’t mention, but the site is in python-Django, I just put the tag on the question. I just tidied up the question.
– Rogerelite
So, I do it in PHP, but the logic is the same, you have to use tools for this or create the sites in different links and redirect to the page you need.
– Marcelo