POC Campus Condorcet : i18n, partie 1

This commit is contained in:
Paul Marillonnet 2017-05-14 17:31:59 +02:00
parent 363927e79e
commit eca281295d
2 changed files with 26 additions and 15 deletions

View File

@ -1,3 +1,4 @@
from django.utils.translation import ugettext as _
from django import forms
from .utils import ldap_get_unites, ldap_get_etablissements
@ -32,40 +33,40 @@ class RegistrationForm(forms.Form):
self.user_nickname = kwargs['initial'].get('user_nickname', '')
self.user_help_msg = kwargs['initial'].get('user_help_msg')
nom = forms.CharField(max_length=100, label="Nom")
prenom = forms.CharField(max_length=100, label="Prenom")
email = forms.CharField(max_length=100, label="Courriel")
nom = forms.CharField(max_length=100, label=_("Last name"))
prenom = forms.CharField(max_length=100, label=_("First name"))
email = forms.CharField(max_length=100, label=_("Email address"))
# Attributes from the Internet2 eduPerson and RENATER SupAnn2009 specifications.
# ep_* -> eduPerson attributes:
ep_principal_name = forms.CharField(max_length=100, label="eduPersonPrincipalName")
ep_primary_affiliation = forms.ChoiceField(required=False,
choices=AFFILIATION_CHOICES,
label="Affiliation principale") # eduPersonPrimaryAffiliation
label=_("Primary affiliation")) # eduPersonPrimaryAffiliation
ep_affiliation = forms.MultipleChoiceField(required=False,
choices=AFFILIATION_CHOICES,
label="Affiliations") # eduPersonPrimaryAffiliation
label=_("Affiliations")) # eduPersonPrimaryAffiliation
# s_* -> supannPerson attributes:
s_etablissement = forms.CharField(max_length=100, label="Etablissement d'origine") # supannEtablissement
s_etablissement = forms.CharField(max_length=100, label=_("Source institution")) # supannEtablissement
s_entite_affectation_principale = forms.ChoiceField(required=False,
choices=AFFECTATION_CHOICES,
label="Affectation principale") # supannEntiteAffectationPrincipale
label=_("Primary assignment unit")) # supannEntiteAffectationPrincipale
s_entite_affectation = forms.MultipleChoiceField(required=False,
choices=AFFECTATION_CHOICES,
label="Affectations") # supannEntiteAffectationPrincipale
s_emp_corps = forms.CharField(max_length=100, label="Corps d'appartenance") # supannEmpCorps
s_liste_rouge = forms.BooleanField(initial=True, label="Liste rouge") # supannListeRouge
label=_("Assignment units")) # supannEntiteAffectation
s_emp_corps = forms.CharField(max_length=100, label=_("Source entity")) # supannEmpCorps
s_liste_rouge = forms.BooleanField(initial=True, label=_("Unlist contact information")) # supannListeRouge
# hote_* -> host attributes:
hote_nom = forms.CharField(max_length=100, label="Nom de la personne invitante")
hote_prenom = forms.CharField(max_length=100, label="Prenom de la personne invitante")
hote_prenom = forms.CharField(max_length=100, label=_("Host's first name"))
hote_nom = forms.CharField(max_length=100, label=_("Host's last name"))
hote_etablissement = forms.ChoiceField(required=False,
choices=ldap_get_etablissements(),
label="Etablissement invitant")
label=_("Host institution"))
hote_unite = forms.ChoiceField(required=False,
choices=ldap_get_unites(),
label="Unite invitante")
label=_("Host entity or unit"))
class Meta:
widgets= {'form' : forms.HiddenInput()}

View File

@ -100,13 +100,13 @@ MIDDLEWARE_CLASSES = (
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
)
ROOT_URLCONF = 'sp_sso.urls'
WSGI_APPLICATION = 'sp_sso.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
@ -130,6 +130,16 @@ USE_L10N = True
USE_TZ = True
gettext = lambda x: x
LANGUAGES = (
('fr', gettext('French')),
('en', gettext('English')),
)
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale_dir/'),
)
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/