Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.i18n.negotiator.subdomain.SubdomainLanguage Class Reference

List of all members.

Public Member Functions

def __init__
def getPreferredLanguages

Public Attributes

 request

Detailed Description

Definition at line 9 of file subdomain.py.


Constructor & Destructor Documentation

Definition at line 13 of file subdomain.py.

00013 
00014     def __init__(self, request):
00015         self.request = request

Here is the caller graph for this function:


Member Function Documentation

Return a sequence of user preferred languages.

Definition at line 16 of file subdomain.py.

00016 
00017     def getPreferredLanguages(self):
00018         """Return a sequence of user preferred languages."""
00019         langs = []
00020 
00021         host = self.request.get('HTTP_HOST', None)
00022         tlds = queryUtility(ICcTLDInformation)
00023         if host is None or tlds is None:
00024             return None
00025 
00026         subdomain = host.split(":")[0].lower().split(".")[0]
00027         wanted = tlds.getTLDs().get(subdomain, [])
00028 
00029         available = queryUtility(ILanguageAvailability)
00030         if available is not None:
00031             langs = [str(lang) for lang in available.getAvailableLanguages()]
00032 
00033         langs = [lang for lang in wanted if lang in langs]
00034         return langs and langs or None

Here is the call graph for this function:


Member Data Documentation

Definition at line 14 of file subdomain.py.


The documentation for this class was generated from the following file: