Index: /main/waeup.sirp/trunk/src/waeup/sirp/language.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/language.py	(revision 7675)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/language.py	(revision 7675)
@@ -0,0 +1,38 @@
+## $Id$
+##
+## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+
+import grokcore.component
+from zope.publisher.interfaces.browser import IBrowserRequest
+from zope.i18n.interfaces import IUserPreferredLanguages
+
+class SIRPLanguage(grokcore.component.Adapter):
+    """Extract the preferred language"""
+    grokcore.component.context(IBrowserRequest)
+    grokcore.component.implements(IUserPreferredLanguages)
+
+    # No need to implement __init__, it's already provided by the base class.
+
+    def getPreferredLanguages(self):
+        # This an adapter for the request, so self.context is the request.
+        request = self.context
+
+        # Extract the preferred language from a cookie:
+        lang = request.cookies.get('waeup.sirp.language', 'en')
+
+        # According to IUserPreferredLanguages, we must return a list.
+        return [lang]
