Пример #1
0
    def user_support_languages(self):
        """The set of user support languages.

        This set includes the user's preferred languages, or request
        languages, or GeoIP languages, according to the implementation of
        preferred_or_request_languages(), which specifies:

        - When the user does not have preferred languages, the languages
          will be inferred from the request Accept-Language header.

        - As a last resort, the code falls back on GeoIP rules to determine
          the user's languages.

        English is added to the list instead when an English variant is
        returned.
        """
        english = getUtility(ILaunchpadCelebrities).english
        languages = set()
        for language in preferred_or_request_languages(self.request):
            if is_english_variant(language):
                languages.add(english)
            else:
                languages.add(language)
        languages = list(languages)
        return languages
Пример #2
0
    def user_support_languages(self):
        """The set of user support languages.

        This set includes the user's preferred languages, or request
        languages, or GeoIP languages, according to the implementation of
        preferred_or_request_languages(), which specifies:

        - When the user does not have preferred languages, the languages
          will be inferred from the request Accept-Language header.

        - As a last resort, the code falls back on GeoIP rules to determine
          the user's languages.

        English is added to the list instead when an English variant is
        returned.
        """
        english = getUtility(ILaunchpadCelebrities).english
        languages = set()
        for language in preferred_or_request_languages(self.request):
            if is_english_variant(language):
                languages.add(english)
            else:
                languages.add(language)
        languages = list(languages)
        return languages