Changeset fd6da93 in OpenWorkouts-current for ow/templates


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/templates/edit_profile.pt

    rd411dae rfd6da93  
    4646                <div>
    4747                  <tal:c tal:condition="getattr(context, 'picture', None)">
    48 
    4948                      <label for="current_picture" i18n:translate="">
    5049                          Current picture:</label>
     
    101100                ${form.textarea('bio', rows=10, cols=50)}
    102101            </p>
    103             <div>
    104               <label for="timezone" i18n:translate="">Timezone:</label>
    105                 <small i18n:translate="">
     102            <div class="input-container ly-flex ly-2 has-gap">
     103              <div>
     104                <label for="timezone" i18n:translate="">Timezone:</label>
     105                <p>
     106                  <small i18n:translate="">
    106107                    All dates and times will be formatted for this timezone
    107                 </small>
     108                  </small>
     109                </p>
     110                ${form.errorlist('timezone')}
     111                ${form.select('timezone', timezones)}
     112              </div>
     113              <div>
     114                <label for="locale" i18n:translate="">Language:</label>
     115                <p>
     116                  <small i18n:translate="">
     117                    All texts in the user interface will appear in this language
     118                  </small>
     119                </p>
     120                ${form.errorlist('locale')}
     121                ${form.select('locale', available_locale_names, selected_value=current_locale)}
     122              </div>
    108123            </div>
    109             ${form.errorlist('timezone')}
    110             ${form.select('timezone', timezones)}
    111124        </fieldset>
    112125
Note: See TracChangeset for help on using the changeset viewer.