Regional Settings Utilities

Module: ppc_robot_lib.utils.regional

activate_regional_settings(user, force_language=None)[source]

Activates regional settings for the given user. The regional settings are stored in the database (:py:class:ppc_robot_lib.models.user_settings.UserSettings model) under the following keys:

  • timezone

  • language

If no user is given, the regional settings will be deactivated.

Parameters:
  • user (AbstractBaseUser | None) – User instance.

  • force_language (str | None) – When set, the language will not be loaded from user settings and this value will be used instead. Can be used to override language from a cookie on a per-browser basis.

Return type:

tuple[bool, bool]

Returns:

Tuple (timezone_activated, language_activated) indicating if timezone/language was activated.