Update translatable strings
Stop using the `_()` function, and use `{% trans %}` tags instead.
This commit is contained in:
parent
496b638694
commit
808c6bbdde
@ -86,7 +86,11 @@ class CalendarSocialApp(Flask):
|
||||
# Make sure we look up users both by their usernames and email addresses
|
||||
self.config['SECURITY_USER_IDENTITY_ATTRIBUTES'] = ('username', 'email')
|
||||
self.config['SECURITY_LOGIN_USER_TEMPLATE'] = 'login.html'
|
||||
|
||||
self.jinja_env.policies['ext.i18n.trimmed'] = True # pylint: disable=no-member
|
||||
|
||||
db.init_app(self)
|
||||
|
||||
babel = Babel(app=self)
|
||||
babel.localeselector(get_locale)
|
||||
|
||||
|
@ -29,7 +29,9 @@
|
||||
<a class="item" href="{{ url_for('security.login') }}">{% trans %}Login{% endtrans %}</a>
|
||||
{% else %}
|
||||
<div class="item">
|
||||
{{ _('Logged in as %(username)s', username=('<a href="' + url_for('display_profile', username=current_user.username) + '">' + current_user.username + '</a>') | safe) }}
|
||||
{% trans username=('<a href="' + url_for('display_profile', username=current_user.username) + '">' + current_user.username + '</a>') | safe -%}
|
||||
Logged in as {{username}}
|
||||
{%- endtrans %}
|
||||
</div>
|
||||
<a class="item" href="{{ url_for('hello') }}">{% trans %}Calendar view{% endtrans %}</a>
|
||||
<a class="item" href="{{ url_for('notifications') }}">{% trans %}Notifications{% endtrans %}</a>
|
||||
|
@ -1,17 +1,21 @@
|
||||
{% extends 'base.html' %}
|
||||
{% from '_macros.html' import field %}
|
||||
|
||||
{% macro time_zone_warning() %}
|
||||
{% trans timezone=event.time_zone, start_time=event.start_time_tz | datetimeformat(rebase=false), end_time=event.end_time_tz | datetimeformat(rebase=false) -%}
|
||||
This event is organised in the {{timezone}} time zone, in which it happens between {{start_time}} and {{end_time}}
|
||||
{%- endtrans %}
|
||||
{% endmacro %}
|
||||
|
||||
{% block content %}
|
||||
<h2 class="ui header">
|
||||
<div class="content">
|
||||
{{ event.title }}<br>
|
||||
<div class="sub header">
|
||||
{%- if current_user.timezone | string != event.time_zone -%}
|
||||
<span title="{{ _('This event is organised in the %(timezone)s time zone, in which it happens between %(start_time)s and %(end_time)s', timezone=event.time_zone, start_time=event.start_time_tz|datetimeformat(rebase=false), end_time=event.end_time_tz|datetimeformat(rebase=false)) }}">
|
||||
<span title="{{ time_zone_warning() }}">
|
||||
<i class="fa fa-exclamation-triangle timezone-warning"></i>
|
||||
<span class="sr-only">
|
||||
{{ _('This event is organised in the %(timezone)s time zone, in which it happens between %(start_time)s and %(end_time)s', timezone=event.time_zone, start_time=event.start_time_tz, end_time=event.end_time_tz) }}
|
||||
</span>
|
||||
<span class="sr-only">{{ time_zone_warning() }}</span>
|
||||
</span>
|
||||
{% endif %}
|
||||
{{ event.start_time_for_user(current_user) | datetimeformat(rebase=false) }}
|
||||
|
@ -1,7 +1,9 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{{ _('Welcome to Calendar.social, %(username)s!', username=current_user.username) }}
|
||||
{% trans username=current_user.username -%}
|
||||
Welcome to Calendar.social, {{username}}!
|
||||
{%- endtrans %}
|
||||
|
||||
{% include 'month-view.html' %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user