[PYTHON] Switch the language displayed in Django 1.9

environment

Ubuntu 14.04.4 LTS Python 3.5.1 Django 1.9.7

Prerequisites

-Django 1.9 for internationalization has been completed

By following the steps below Japanese at http://hoge.com/ja/huga English at http://hoge.com/en/huga Etc. can be switched.

procedure

Modify urls.py

--Added the following to path /to/project/project/urls.py

```python:urls.py
from django.conf.urls.i18n import i18n_patterns
```

```python:urls.py
urlpatterns += i18n_patterns('',
    #If you want to switch the language of the admin page
    url(r'^admin/', include(admin.site.urls)),

    #If you want to switch the language of the app called myapp
    url(r'^myapp/', include('myapp.urls', namespace='myapp')),
)
```

With this alone, you can switch languages.

Recommended Posts

Switch the language displayed in Django 1.9
The meaning of ".object" in Django
In Django, how to abbreviate the long displayed string as ....
Get the query string (query string) in Django
Get the client's IP address in Django
Django ~ Let's display it in the browser ~
Looking back on 2016 in the Crystal language
Draw graphs in the programming language Julia
Try hitting the Spotify API in Django.
The date is displayed incorrectly in matplotlib.
Models in Django
Forms in Django
The _authenticate_with_backend function was obsolete in django auth.autenticate
I wrote the hexagonal architecture in go language
Specify the view URL in your Django template
The story of viewing media files in Django
[Django] css in the project cannot be read
Even if the development language is changed to python3 in Cloud9, version 2 is displayed in python --version
Learning notes for the migrations feature in the Django framework (2)
[Django] Perform Truncate Table (delete all data in the table)
Check if it is Unix in the scripting language
Set the form DateField to type = date in Django
[Tips] Save / copy the graph displayed in Jupyter Lab
Model changes in Django
Learning notes for the migrations feature in the Django framework (3)
[Django] Rename the project
Learning notes for the migrations feature in the Django framework (1)
Check if it is Unix in the scripting language
How to write custom validations in the Django REST Framework
Set the DateTime type output format in your Django template
I participated in the translation activity of Django official documents
Django + MongoDB development environment maintenance (in the middle of writing)
A note for embedding the scripting language in a bash script
Note 2 for embedding the scripting language in a bash script
Summary of stumbling blocks in Django for the first time
I tried to illustrate the time and time in C language
How to generate a query using the IN operator in Django
Display the time in Django according to the user's region (UTC)
I can't log in to the admin page with Django3
About the number (section number) in () displayed by the Linux man command
Change the message displayed when logging in to Raspberry Pi
Performance optimization in Django 3.xx
Machine language embedding in C language
PHP var_dump in Django templates
Handle constants in Django templates
Implement follow functionality in Django
Heapsort made in C language
Download the file in Python
Find the difference in Python
Output table structure in Django
Programming language in "Hello World"
Methods available in the list
Hello World in GO language
(Note) Django in Vagrant environment
django timezone and language settings
Show Django ManyToManyField in Template
Django cannot be installed in the development environment of pipenv + pyenv
Loop the For statement in reverse in an HTML file on Django
[Python] The value written in Openpyxl is displayed in exponential notation (E).
Dockerfile with the necessary libraries for natural language processing in python
Read the config file in Go language! Introducing a simple sample