Changeset fd6da93 in OpenWorkouts-current for ow/utilities.py


Ignore:
Timestamp:
Feb 26, 2019, 11:11:43 AM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current, feature/docs, master
Children:
a4e4799
Parents:
d411dae
Message:

(#56) Add support for different locale/language:

  • Let users choose their lang/locale in the edit profile page
  • Set the currently selected locale as a cookie (following pyramid docs on how to set the locale using the default locale negotiator)
  • Save the locale setting for each user as an attribute on the User model
  • Set the proper locale as a cookie on login
  • Unset the locale cookie on logout

Default available locales for now are en (english) and es (spanish)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/utilities.py

    rd411dae rfd6da93  
    296296        if value[0] <= dt.hour <= value[1]:
    297297            return key
     298
     299
     300def get_available_locale_names():
     301    """
     302    Return a list of tuples with info about available locale/language
     303    names.
     304
     305    The locale codes and names in this list match the available translations
     306    under ow/locale for the UI elements
     307    """
     308    return [
     309        ('en', _('English')),
     310        ('es', _('Spanish'))
     311    ]
Note: See TracChangeset for help on using the changeset viewer.