Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
piphone
campaign
Commits
4226437d
Commit
4226437d
authored
Nov 23, 2014
by
Raphaël Vinot
Browse files
Add basic support for localization
parent
f754014f
Changes
10
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
4226437d
...
...
@@ -9,3 +9,6 @@ ve/
venv/
.venv/
.env/
# Compiled locales
*.mo
compile_pofiles.sh
0 → 100755
View file @
4226437d
#!/bin/bash
set
-e
set
-x
./manage.py compilemessages
generate_pofiles.sh
0 → 100755
View file @
4226437d
#!/bin/bash
set
-e
set
-x
IGNORE_DIRS
=
'virtenv build'
ignore
=
''
for
d
in
${
IGNORE_DIRS
}
;
do
ignore
=
"
${
ignore
}
--ignore=
${
d
}
"
done
./manage.py makemessages
-l
de
${
ignore
}
./manage.py makemessages
-l
fr
${
ignore
}
./manage.py makemessages
-l
en
${
ignore
}
locale/de/LC_MESSAGES/django.po
0 → 100644
View file @
4226437d
# 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: 2014-11-23 15:35+0100\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=2; plural=(n != 1);\n"
#: picampaign/campaign/models.py:22 picampaign/campaign/models.py:34
msgid "language"
msgstr "sprache"
#: picampaign/campaign/models.py:38
msgid "Argumentary in %(lang) for %(title)"
msgstr ""
#: picampaign/campaign/models.py:50
msgid "Contact %(ccontact) on %(title)"
msgstr ""
#: picampaign/contact/models.py:16
#, python-format
msgid "%(firstname) %(lastname)"
msgstr ""
#: picampaign/feedback/models.py:14
msgid "feedback for %(callee contact) on %(campaign title)"
msgstr ""
#: picampaign/settings.py:78
msgid "English"
msgstr "Englisch"
#: picampaign/settings.py:79
msgid "German"
msgstr "Deutsch"
#: picampaign/settings.py:80
msgid "French"
msgstr "Französisch"
locale/en/LC_MESSAGES/django.po
0 → 100644
View file @
4226437d
# 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: 2014-11-23 15:35+0100\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"
#: picampaign/campaign/models.py:22 picampaign/campaign/models.py:34
msgid "language"
msgstr "language"
#: picampaign/campaign/models.py:38
msgid "Argumentary in %(lang) for %(title)"
msgstr ""
#: picampaign/campaign/models.py:50
msgid "Contact %(ccontact) on %(title)"
msgstr ""
#: picampaign/contact/models.py:16
#, python-format
msgid "%(firstname) %(lastname)"
msgstr ""
#: picampaign/feedback/models.py:14
msgid "feedback for %(callee contact) on %(campaign title)"
msgstr ""
#: picampaign/settings.py:78
msgid "English"
msgstr ""
#: picampaign/settings.py:79
msgid "German"
msgstr ""
#: picampaign/settings.py:80
msgid "French"
msgstr ""
locale/fr/LC_MESSAGES/django.po
0 → 100644
View file @
4226437d
# 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: 2014-11-23 15:35+0100\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=2; plural=(n > 1);\n"
#: picampaign/campaign/models.py:22 picampaign/campaign/models.py:34
msgid "language"
msgstr "langue"
#: picampaign/campaign/models.py:38
msgid "Argumentary in %(lang) for %(title)"
msgstr ""
#: picampaign/campaign/models.py:50
msgid "Contact %(ccontact) on %(title)"
msgstr ""
#: picampaign/contact/models.py:16
#, python-format
msgid "%(firstname) %(lastname)"
msgstr ""
#: picampaign/feedback/models.py:14
msgid "feedback for %(callee contact) on %(campaign title)"
msgstr ""
#: picampaign/settings.py:78
msgid "English"
msgstr "Anglais"
#: picampaign/settings.py:79
msgid "German"
msgstr "Allemand"
#: picampaign/settings.py:80
msgid "French"
msgstr "Francais"
picampaign/campaign/models.py
View file @
4226437d
...
...
@@ -35,7 +35,8 @@ class Argumentary(models.Model):
text
=
models
.
TextField
(
null
=
True
)
def
__unicode__
(
self
):
return
'Argumentary in %s for %s'
%
(
self
.
lang
,
self
.
campaign
.
title
)
return
_
(
'Argumentary in %(lang) for %(title)'
)
%
{
'lang'
:
self
.
lang
,
'title'
:
self
.
campaign
.
title
}
class
CampaignContact
(
models
.
Model
):
...
...
@@ -46,7 +47,8 @@ class CampaignContact(models.Model):
weight
=
models
.
IntegerField
(
default
=
0
)
def
__unicode__
(
self
):
return
'Contact %s on %s'
%
(
self
.
contact
,
self
.
campaign
.
title
)
return
_
(
'Contact %(ccontact) on %(title)'
)
%
{
'contact'
:
self
.
contact
,
'title'
:
self
.
campaign
.
title
}
def
all_groups
(
self
):
return
[
x
.
name
for
x
in
self
.
contact
.
groups
.
all
()]
picampaign/contact/models.py
View file @
4226437d
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
class
Contact
(
models
.
Model
):
...
...
@@ -12,4 +13,5 @@ class Contact(models.Model):
photo
=
models
.
ImageField
(
upload_to
=
'contacts/photos'
,
blank
=
True
)
def
__unicode__
(
self
):
return
'%s %s'
%
(
self
.
first_name
,
self
.
last_name
)
return
_
(
'%(firstname) %(lastname)'
)
%
{
'firstname'
:
self
.
first_name
,
'lastname'
:
self
.
last_name
}
picampaign/feedback/models.py
View file @
4226437d
from
django.db
import
models
from
picampaign.campaign.models
import
CampaignContact
from
picampaign.organization.models
import
FeedbackCategory
from
django.utils.translation
import
ugettext_lazy
as
_
class
Feedback
(
models
.
Model
):
...
...
@@ -10,5 +11,6 @@ class Feedback(models.Model):
comment
=
models
.
CharField
(
max_length
=
512
,
blank
=
True
)
def
__unicode__
(
self
):
return
'feedback for %s on %s'
%
(
self
.
callee
.
contact
,
self
.
callee
.
campaign
.
title
)
return
_
(
'feedback for %(callee contact) on %(campaign title)'
)
%
\
{
'callee contact'
:
self
.
callee
.
contact
,
'campaign title'
:
self
.
callee
.
campaign
.
title
}
picampaign/settings.py.sample
View file @
4226437d
...
...
@@ -10,6 +10,7 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from django.utils.translation import ugettext_lazy as _
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
...
...
@@ -45,6 +46,7 @@ INSTALLED_APPS = (
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
...
...
@@ -71,6 +73,12 @@ DATABASES = {
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGES = (
('en', _('English')),
('de', _('German')),
('fr', _('French')),
)
LANGUAGE_CODE = 'fr-FR'
TIME_ZONE = 'Europe/Paris'
...
...
@@ -86,6 +94,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
#REST_FRAMEWORK = {
# 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAdminUser',),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment