diff --git a/fas/.gitignore b/fas/.gitignore
index dec3ed5..3021ee9 100644
--- a/fas/.gitignore
+++ b/fas/.gitignore
@@ -8,4 +8,5 @@ fas.log
*.pyc
*.pyo
*.swp
+*.mo
fas.egg-info
diff --git a/fas/fas/config/app.cfg b/fas/fas/config/app.cfg
index 2afa041..7bab914 100644
--- a/fas/fas/config/app.cfg
+++ b/fas/fas/config/app.cfg
@@ -59,6 +59,8 @@ genshi.encoding="utf-8"
# i18n
session_filter.on = True
i18n.run_template_filter = True
+i18n.domain = 'fas'
+i18n.locale_dir = 'po'
# VISIT TRACKING
# Each visit to your application will be assigned a unique visit ID tracked via
diff --git a/fas/fas/controllers.py b/fas/fas/controllers.py
index 2815eda..58d53ec 100644
--- a/fas/fas/controllers.py
+++ b/fas/fas/controllers.py
@@ -5,6 +5,7 @@ from cherrypy import request, response
from turbogears import exception_handler
import turbogears
+import cherrypy
import time
from fas.user import User
@@ -24,6 +25,17 @@ def add_custom_stdvars(vars):
turbogears.view.variable_providers.append(add_custom_stdvars)
+def get_locale(locale=None):
+ if locale:
+ return locale
+ if turbogears.identity.current.user_name:
+ person = People.by_username(turbogears.identity.current.user_name)
+ return person.locale
+ else:
+ return turbogears.i18n.utils._get_locale()
+
+config.update({'i18n.get_locale': get_locale})
+
# from fas import json
# import logging
# log = logging.getLogger("fas.controllers")
@@ -101,6 +113,14 @@ class Root(controllers.RootController):
@expose()
def logout(self):
- identity.current.logout()
turbogears.flash(_('You have successfully logged out.'))
+ identity.current.logout()
raise redirect(request.headers.get("Referer", "/"))
+
+ @expose()
+ def language(self, locale):
+ locale_key = config.get("i18n.session_key", "locale")
+ cherrypy.session[locale_key] = locale
+ raise redirect(request.headers.get("Referer", "/"))
+
+
diff --git a/fas/fas/static/css/style.css b/fas/fas/static/css/style.css
index fa0f658..e861567 100644
--- a/fas/fas/static/css/style.css
+++ b/fas/fas/static/css/style.css
@@ -189,6 +189,21 @@ a
background: #082C59;
}
+#language
+{
+ padding: 1ex;
+}
+
+#language label
+{
+ color: #FFFFFF;
+}
+
+#language input
+{
+ width: 4ex;
+}
+
#content
{
margin-left: 22ex;
diff --git a/fas/fas/templates/master.html b/fas/fas/templates/master.html
index 8e76e85..421a82d 100644
--- a/fas/fas/templates/master.html
+++ b/fas/fas/templates/master.html
@@ -64,6 +64,13 @@
diff --git a/fas/fas/templates/openid/about.html b/fas/fas/templates/openid/about.html
index 4ac41f7..2cbe67f 100644
--- a/fas/fas/templates/openid/about.html
+++ b/fas/fas/templates/openid/about.html
@@ -7,9 +7,9 @@
${_('Fedora Accounts System')}
-
${_{'Fedora Project OpenID Provider')}
+
${_('Fedora Project OpenID Provider')}
- ${Markup_('Description goes here, <a href="http://username.fedorapeople.org/">username.fedorapeople.org</a>'))}
+ ${Markup_('Description goes here, <a href="http://username.fedorapeople.org/">username.fedorapeople.org</a>')}