Skip to content

Commit

Permalink
Add gettext. Prepare app students for i10n.
Browse files Browse the repository at this point in the history
  • Loading branch information
miletskiy committed Oct 8, 2015
1 parent a3efbbe commit 6ee60e6
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
4 changes: 3 additions & 1 deletion students/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
# Make handler for migrate
from django.db.models.signals import post_migrate

Expand All @@ -10,7 +11,8 @@

class StudentsAppConfig(AppConfig):
name = 'students'
verbose_name = u'База студентив'
verbose_name = _(u'Students Database')
# verbose_name = _(u'База студентив')

def ready(self):
from students import signals
Expand Down
22 changes: 22 additions & 0 deletions students/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-08 20:09+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: apps.py:14
msgid "Students Database"
msgstr ""
24 changes: 24 additions & 0 deletions students/locale/uk/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-08 20:09+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"

#: apps.py:14
msgid "Students Database"
msgstr "студентовая база"
21 changes: 16 additions & 5 deletions studentsdb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 'django.contrib.sites.models',
'django.contrib.sites.models',
'crispy_forms',
'students',
)

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand All @@ -65,9 +66,10 @@
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
# 'django.template.context_processors.i18n',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
"students.context_processors.groups_processor",
"studentsdb.context_processors.students_proc",
Expand Down Expand Up @@ -100,11 +102,20 @@

LANGUAGE_CODE = 'uk'

USE_L10N = True

USE_TZ = True

TIME_ZONE = 'Europe/Kiev'
TIME_ZONE = 'UTC'
# TIME_ZONE = 'Europe/Kiev'

USE_L10N = True

# LOCALE_PATHS = (
# '/data/work/buildouts/python/studentsdb/src/studentsdb/students/locale/uk',
# '/data/work/buildouts/python/studentsdb/src/studentsdb/students/locale/en',
# )
# LOCALE_PATHS = (
# os.path.join(BASE_DIR, 'locale'),
# )

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
Expand Down

0 comments on commit 6ee60e6

Please sign in to comment.