<a href="/terms">{{ _("Terms & Conditions") }}</a>
</li>
{% end %}
-
- {% if not hostname == "planet.ipfire.org" %}
- {% for l in ("en", "de") %}
- {% if not l == lang %}
- <li class="text-muted">·</li>
- <li>
- <a href="?locale={{ l }}">
- <img src="{{ static_url("images/flags/%s.png" % l) }}" alt="{{ l }}">
- </a>
- </li>
- {% end %}
- {% end %}
- {% end %}
</ul>
<p>
# Find the name of the author
return self.accounts.find(uid)
- def get_query_locale(self):
- locale = self.get_argument("locale", None)
-
- if locale is None:
- return
-
- return tornado.locale.get(locale)
-
- def prepare(self):
- locale = self.get_query_locale()
- if locale:
- self.set_cookie("locale", locale.code)
-
def get_user_locale(self):
# The planet is always in english.
if self.request.host == "planet.ipfire.org":
return tornado.locale.get("en_US")
- # Get the locale from the query.
- locale = self.get_query_locale()
- if locale:
- return locale
-
- # Read the locale from the cookies.
- locale = self.get_cookie("locale", None)
- if locale:
- return tornado.locale.get(locale)
-
# Otherwise take the browser locale.
return self.get_browser_locale()