MCPcopy Create free account
hub / github.com/EasyIME/PIME / locale

Method locale

python/python3/tornado/web.py:1251–1269  ·  view source on GitHub ↗

The locale for the current session. Determined by either `get_user_locale`, which you can override to set the locale based on, e.g., a user preference stored in a database, or `get_browser_locale`, which uses the ``Accept-Language`` header. .. versionchanged

(self)

Source from the content-addressed store, hash-verified

1249
1250 @property
1251 def locale(self) -> tornado.locale.Locale:
1252 """The locale for the current session.
1253
1254 Determined by either `get_user_locale`, which you can override to
1255 set the locale based on, e.g., a user preference stored in a
1256 database, or `get_browser_locale`, which uses the ``Accept-Language``
1257 header.
1258
1259 .. versionchanged: 4.1
1260 Added a property setter.
1261 """
1262 if not hasattr(self, "_locale"):
1263 loc = self.get_user_locale()
1264 if loc is not None:
1265 self._locale = loc
1266 else:
1267 self._locale = self.get_browser_locale()
1268 assert self._locale
1269 return self._locale
1270
1271 @locale.setter
1272 def locale(self, value: tornado.locale.Locale) -> None:

Callers

nothing calls this directly

Calls 2

get_user_localeMethod · 0.95
get_browser_localeMethod · 0.95

Tested by

no test coverage detected