Skip to content

Commit

Permalink
[QOLDEV-955] make i18n hack more robust
Browse files Browse the repository at this point in the history
- Pass on any and all parameters unchanged, just patch the result
  • Loading branch information
ThrawnCA committed Oct 25, 2024
1 parent 7bd8b2b commit 6d52bfd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ckanext/qgov/common/views/user.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# encoding: utf-8

from flask import Blueprint
from typing import Any

from ckan.plugins.toolkit import g, redirect_to, url_for
import ckan.views.user
Expand All @@ -23,9 +24,9 @@ def user_edit_override():
return EditView().dispatch_request()


def _gettext_wrapper(key):
translation = original_gettext(key)
if key == 'Login failed. Bad username or password.':
def _gettext_wrapper(*args: Any, **kwargs: Any):
translation = original_gettext(*args, **kwargs)
if 'Bad username or password.' in translation:
translation = translation.replace('or password.', 'or password or reCAPTCHA.')
return translation

Expand Down

0 comments on commit 6d52bfd

Please sign in to comment.