Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webactivity.py
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2012-01-13 11:35:18 (GMT)
committer Manuel QuiƱones <manuq@laptop.org>2012-01-23 12:28:21 (GMT)
commitdd61998241129b0546fb9e5c513d1bafae63e329 (patch)
tree45b22d60af96be3500ca7ed0b933c08f9829ae8c /webactivity.py
parent356c2da64a39244fb309a8274e6ec72cff0efe0a (diff)
Display pages based on locale specific information
This displays pages based on your locale information e.g. 'google.com' will be in French when your locale is set to 'fr'. We use our associated SoupSession to set the "accept-language-auto" property [1] which will set the 'accept-language' header when making requests based on the return value of g_get_language_names() [2]. This does replace our custom code that did determine the locale information and the 'intl.accept_languages' [3] property before. [1] http://developer.gnome.org/libsoup/stable/SoupSession.html#SoupSession--accept-language-auto [2] http://developer.gimp.org/api/2.0/glib/glib-I18N.html#g-get-language-names [3] http://kb.mozillazine.org/About:config_entries#Intl. Signed-off-by: Simon Schampijer <simon@laptop.org>
Diffstat (limited to 'webactivity.py')
-rw-r--r--webactivity.py21
1 files changed, 5 insertions, 16 deletions
diff --git a/webactivity.py b/webactivity.py
index 7f2eafa..8b8db59 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -27,6 +27,8 @@ GObject.threads_init()
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
+from gi.repository import WebKit
+
import base64
import time
import shutil
@@ -138,20 +140,6 @@ def _set_char_preference(name, value):
branch.setCharPref(name, value)
-def _set_accept_languages():
- """Set intl.accept_languages preference based on the locale"""
-
- lang = locale.getdefaultlocale()[0]
- if not lang:
- _logger.debug("Set_Accept_language: unrecognised LANG format")
- return
- lang = lang.split('_')
-
- # e.g. es-uy, es
- pref = lang[0] + "-" + lang[1].lower() + ", " + lang[0]
- _set_char_preference('intl.accept_languages', pref)
- logging.debug('LANG set')
-
from browser import TabbedView
from webtoolbar import PrimaryToolbar
from edittoolbar import EditToolbar
@@ -179,6 +167,9 @@ class WebActivity(activity.Activity):
_logger.debug('Starting the web activity')
+ session = WebKit.get_default_session()
+ session.set_property('accept-language-auto', True)
+
# FIXME
# downloadmanager.remove_old_parts()
@@ -186,8 +177,6 @@ class WebActivity(activity.Activity):
self._tabbed_view = TabbedView()
self._tabbed_view.connect('focus-url-entry', self._on_focus_url_entry)
- # FIXME
- # _set_accept_languages()
_seed_xs_cookie()
# HACK