Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two-factor strings #12448

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
26 changes: 15 additions & 11 deletions weblate/accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ def clean(self, value):
existing = User.objects.filter(username=value)
if existing.exists() and value != self.valid:
raise forms.ValidationError(
gettext("This username is already taken. Please choose another.")
gettext(
"This username is already taken. Please pick something else."
)
)

return super().clean(value)
Expand Down Expand Up @@ -197,7 +199,7 @@ class CommitForm(ProfileBaseForm):
label=gettext_lazy("Commit e-mail"),
choices=[("", gettext_lazy("Use account e-mail address"))],
help_text=gettext_lazy(
"Used in version control commits. The address will stay in the repository forever once changes are committed by Weblate."
"Used in version-control commits. The address stays in the repository forever once changes are committed by Weblate."
),
required=False,
widget=forms.RadioSelect,
Expand Down Expand Up @@ -230,7 +232,7 @@ class ProfileForm(ProfileBaseForm):

public_email = forms.ChoiceField(
label=gettext_lazy("Public e-mail"),
choices=[("", gettext_lazy("Do not publicly display e-mail address"))],
choices=[("", gettext_lazy("Hide e-mail address from public view"))],
required=False,
)

Expand Down Expand Up @@ -421,7 +423,7 @@ class ContactForm(forms.Form):
label=gettext_lazy("Message"),
required=True,
help_text=gettext_lazy(
"Please contact us in English, otherwise we might "
"Please contact us in English. Otherwise we might "
"be unable to process your request."
orangesunny marked this conversation as resolved.
Show resolved Hide resolved
),
max_length=2000,
Expand All @@ -437,7 +439,7 @@ class EmailForm(UniqueEmailMixin):

email = EmailField(
label=gettext_lazy("E-mail"),
help_text=gettext_lazy("E-mail with a confirmation link will be sent here."),
help_text=gettext_lazy("An e-mail with a confirmation link will be sent here."),
)


Expand All @@ -464,7 +466,7 @@ def clean(self):
ngettext(
(
"Too many failed registration attempts from this location. "
"Please try again in %d minute."
"Please try again in one minute."
Copy link
Contributor Author

@comradekingu comradekingu Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was GTK for whatever reason this isn't allowed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this fails:

>>> ngettext('one apple', '%d apples', 1) % 1
Traceback (most recent call last):
  File "<console>", line 1, in <module>
TypeError: not all arguments converted during string formatting

comradekingu marked this conversation as resolved.
Show resolved Hide resolved
),
(
"Too many failed registration attempts from this location. "
Expand Down Expand Up @@ -586,7 +588,7 @@ def __init__(self, request: AuthenticatedHttpRequest, *args, **kwargs) -> None:
class PasswordConfirmForm(EmptyConfirmForm):
password = PasswordField(
label=gettext_lazy("Current password"),
help_text=gettext_lazy("Leave empty if you have not yet set a password."),
help_text=gettext_lazy("Leave empty if you have not set a password yet."),
required=False,
)

Expand Down Expand Up @@ -642,7 +644,7 @@ def clean(self):
ngettext(
(
"Too many authentication attempts from this location. "
"Please try again in %d minute."
"Please try again in one minute."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Please try again in one minute."
"Please try again in %d minute."

),
(
"Too many authentication attempts from this location. "
Expand Down Expand Up @@ -916,7 +918,9 @@ def clean_sort_by(self):
sort_by = self.cleaned_data.get("sort_by")
if sort_by:
if sort_by not in self.sort_values:
raise forms.ValidationError(gettext("Chosen sorting is not supported."))
raise forms.ValidationError(
gettext("The chosen sorting is not supported.")
)
return sort_by
return None

Expand Down Expand Up @@ -975,7 +979,7 @@ class TOTPDeviceForm(forms.Form):
)

error_messages = {
"invalid_token": gettext_lazy("Entered token is not valid."),
"invalid_token": gettext_lazy("The entered token is wrong."),
comradekingu marked this conversation as resolved.
Show resolved Hide resolved
}

def __init__(self, key, user, metadata=None, **kwargs):
Expand Down Expand Up @@ -1045,7 +1049,7 @@ class OTPTokenForm(DjangoOTPTokenForm):
otp_token = forms.CharField(
label=gettext("Recovery token"),
help_text=gettext(
"Recovery token can be used just once, mark your token as used after using it."
"Recovery codes can only be used once. Remember to mark used ones as expired."
),
)
device_class: type[Device] = StaticDevice
Expand Down
20 changes: 10 additions & 10 deletions weblate/templates/accounts/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ <h4 class="panel-title">
<div class="col-sm-4">
<h5>{% trans "Security keys (WebAuthn)" %}</h5>
{% if not webauthn_keys %}
<p><em>{% trans "There are currently no WebAuthn keys registered." %}</em></p>
<p><em>{% trans "No WebAuthn keys registered yet." %}</em></p>
{% else %}
<ul class="list-group">
{% for key in webauthn_keys %}
Expand All @@ -217,7 +217,7 @@ <h5>{% trans "Security keys (WebAuthn)" %}</h5>
</template>

<template id="passkey-registration-unavailable-template">
<p>{% trans "Unfortunately, your browser has no WebAuthn support." %}</p>
<p>{% trans "Your web browser lacks WebAuthn support." %}</p>
</template>

<span id="passkey-registration-placeholder"></span>
Expand All @@ -227,7 +227,7 @@ <h5>{% trans "Security keys (WebAuthn)" %}</h5>
<div class="col-sm-4">
<h5>{% trans "Authenticator apps (TOTP)" %}</h5>
{% if not totp_keys %}
<p><em>{% trans "There are currently no authenticator apps registered." %}</em></p>
<p><em>{% trans "No authenticator apps registered yet." %}</em></p>
{% else %}
<ul class="list-group">
{% for key in totp_keys %}
Expand All @@ -244,14 +244,14 @@ <h5>{% trans "Authenticator apps (TOTP)" %}</h5>
<div class="col-sm-4">
<h5>{% trans "Recovery codes" %}</h5>
{% if recovery_keys_count == 0 %}
<p><em>{% trans "There are currently no recovery codes generated." %}</em></p>
<p><em>{% trans "No recovery codes generated yet." %}</em></p>
<a href="" data-href="{% url "recovery-codes" %}" class="btn btn-primary link-post">{% trans "Generate new recovery codes" %}</a>
{% else %}
<p>
{% blocktranslate count count=recovery_keys_count trimmed %}
{{ count }} recovery code is available.
{{ count }} recovery code available.
{% plural %}
{{ count }} recovery codes are available.
{{ count }} recovery codes available.
{% endblocktranslate %}
</p>
<a href="{% url "recovery-codes" %}" class="btn btn-primary">{% trans "View recovery codes" %}</a>
Expand Down Expand Up @@ -300,7 +300,7 @@ <h5>{% trans "Recovery codes" %}</h5>
<div class="panel-body">
{% crispy profileform %}
<p class="help-block">
{% blocktrans %}All of the fields on this page are optional and can be deleted at any time, and by filling them out, you're giving us consent to share this data wherever your user profile appears.{% endblocktrans %}
{% blocktrans %}All fields on this page are optional and can be deleted at any time. By filling them out, you allow to their use wherever your user profile appears.{% endblocktrans %}
</p>
</div>
<div class="panel-footer">
Expand Down Expand Up @@ -390,7 +390,7 @@ <h5>{% trans "Recovery codes" %}</h5>
<div class="panel panel-default">
<div class="panel-heading"><h4 class="panel-title">{% trans "Description" %}</h4></div>
<div class="panel-body">
<p>{% blocktrans %}Contact us immediately if you see anything suspicious in the audit log.{% endblocktrans %}</p>
<p>{% blocktrans %}Get in contact immediately if you notice anything suspicious in the audit log.{% endblocktrans %}</p>
</div>
</div>

Expand All @@ -414,7 +414,7 @@ <h5>{% trans "Recovery codes" %}</h5>
<td>{{ log.user_agent }}</td>
</tr>
{% empty %}
<tr><td colspan="4">{% trans "No recent activity found!" %}</td></tr>
<tr><td colspan="4">{% trans "No recent activity found." %}</td></tr>
{% endfor %}
</tbody>
</table>
Expand All @@ -430,7 +430,7 @@ <h5>{% trans "Recovery codes" %}</h5>
<div class="panel-heading"><h4 class="panel-title">{% documentation_icon 'api' right=True %}{% trans "API access" %}</h4></div>
<table class="table">
<tr><td colspan="2">
<p>{% blocktrans %}You can control Weblate using the HTTP REST API and your API key is used to authenticate to it.{% endblocktrans %}</p>
<p>{% blocktrans %}Your your API key can be used to control Weblate via the HTTP REST API.{% endblocktrans %}</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double "your".

comradekingu marked this conversation as resolved.
Show resolved Hide resolved
</td></tr>
<tr>
<th>{% trans "Your personal API key:" %}</th>
Expand Down
6 changes: 3 additions & 3 deletions weblate/templates/accounts/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,14 @@ <h4 class="panel-title">
</div>
<div class="panel-body">
{% if page_user.profile.has_2fa %}
{% trans "User has two-factor authentication configured." %}
{% trans "The user has two-factor authentication configured." %}
Copy link
Contributor Author

@comradekingu comradekingu Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% trans "The user has two-factor authentication configured." %}
{% trans "The user has two-factor authentication." %}

adding "in Weblate" might help specify that it isn't for one of the other OAuths

{% else %}
{% trans "User doesn't have two-factor authentication configured." %}
{% trans "The user doesn't have two-factor authentication configured." %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% trans "The user doesn't have two-factor authentication configured." %}
{% trans "The user doesn't have two-factor authentication." %}

{% endif %}
</div>
{% if page_user.profile.has_2fa %}
<div class="panel-footer">
<input type="submit" name="remove_2fa" value="{% trans "Disable two-factor authentication" %}" class="btn-danger red">
<input type="submit" name="remove_2fa" value="{% trans "Turn off two-factor authentication" %}" class="btn-danger red">
</div>
{% endif %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/addons/addon_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</table>
<div class="panel-footer">
{% if scope == "sitewide" %}
{% trans "Add-ons can be installed on project and component scope as well." %}
{% trans "Add-ons can be also be installed on project- and component level." %}
{% endif %}
{% if scope == "component" %}
<a href="{% url 'addons' path=object.project.get_url_path %}" class="btn btn-primary">
Expand Down
Loading