add a new translation warning and improve the old one
implements https://github.com/liberapay/salon/issues/520 closes #922
This commit is contained in:
parent
ed02c75ad5
commit
d19fd39498
@ -1,4 +1,13 @@
|
||||
% if state.get('partial_translation')
|
||||
<div class="notification notification-warning top">{{ _(
|
||||
"The {language} translation of this page is not yet complete."
|
||||
, language=locale
|
||||
"The translation of this page from English is not yet complete. {link_start}You can contribute{link_end}."
|
||||
, link_start=('<a href="https://hosted.weblate.org/engage/liberapay/{}/?utm_source=liberapay-incomplete-translation-warning">'|safe).format(locale.global_tag)
|
||||
, link_end='</a>'|safe
|
||||
) }}</div>
|
||||
% elif state.get('fuzzy_translation')
|
||||
<div class="notification notification-warning top">{{ _(
|
||||
"This page contains machine-translated text which hasn't yet been reviewed and might be inaccurate. {link_start}You can contribute{link_end}."
|
||||
, link_start=('<a href="https://hosted.weblate.org/engage/liberapay/{}/?utm_source=liberapay-machine-translation-warning">'|safe).format(locale.global_tag)
|
||||
, link_end='</a>'|safe
|
||||
) }}</div>
|
||||
% endif
|
||||
|
@ -124,6 +124,8 @@ class Locale(babel.core.Locale):
|
||||
s2 = msg.string
|
||||
if isinstance(s2, tuple):
|
||||
s2 = s2[0]
|
||||
if msg.fuzzy:
|
||||
state['fuzzy_translation'] = True
|
||||
if not s2:
|
||||
s2 = s
|
||||
if self.language != 'en':
|
||||
@ -148,6 +150,9 @@ class Locale(babel.core.Locale):
|
||||
s2 = msg.string[self.catalog.plural_func(n)]
|
||||
except Exception as e:
|
||||
website.tell_sentry(e)
|
||||
else:
|
||||
if msg.fuzzy:
|
||||
state['fuzzy_translation'] = True
|
||||
if not s2:
|
||||
s2 = s if n == 1 else p
|
||||
if self.language != 'en':
|
||||
|
@ -147,7 +147,7 @@
|
||||
</div>
|
||||
% endif
|
||||
|
||||
% if state.get('partial_translation')
|
||||
% if state.get('partial_translation') or state.get('fuzzy_translation')
|
||||
% include "_i18n_warning.html"
|
||||
% endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user