Skip to content

Commit

Permalink
fix: consistent spelling for read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Dec 20, 2024
1 parent c3b1e8d commit fb8534d
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ and XLIFF.
:>json string note: translation unit note
:>json string flags: translation unit flags
:>json array labels: translation unit labels, available on source units
:>json int state: unit state, 0 - untranslated, 10 - needs editing, 20 - translated, 30 - approved, 100 - read only
:>json int state: unit state, 0 - untranslated, 10 - needs editing, 20 - translated, 30 - approved, 100 - read-only
:>json boolean fuzzy: whether the unit is fuzzy or marked for review
:>json boolean translated: whether the unit is translated
:>json boolean approved: whether the translation is approved
Expand Down
4 changes: 2 additions & 2 deletions weblate/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3658,14 +3658,14 @@ def test_translate_unit(self) -> None:
kwargs={"pk": unit.pk},
method="patch",
code=400,
request={"state": "100", "target": "Test read only translation"},
request={"state": "100", "target": "Test read-only translation"},
)
self.do_request(
"api:unit-detail",
kwargs={"pk": unit.pk},
method="patch",
code=400,
request={"state": "0", "target": "Test read only translation"},
request={"state": "0", "target": "Test read-only translation"},
)
self.do_request(
"api:unit-detail",
Expand Down
6 changes: 3 additions & 3 deletions weblate/auth/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ def check_edit_approved(user: User, permission: str, obj: Model):
if isinstance(obj, Unit):
unit = obj
obj = unit.translation
# Read only check is unconditional as there is another one
# Read-only check is unconditional as there is another one
# in PluralTextarea.render
if unit.readonly:
if not unit.source_unit.translated:
return Denied(gettext("The source string needs review."))
return Denied(gettext("The string is read only."))
return Denied(gettext("The string is read-only."))
# Ignore approved state if review is not disabled. This might
# happen after disabling them.
if (
Expand All @@ -289,7 +289,7 @@ def check_edit_approved(user: User, permission: str, obj: Model):
if isinstance(obj, Translation):
component = obj.component
if obj.is_readonly:
return Denied(gettext("The translation is read only."))
return Denied(gettext("The translation is read-only."))
elif isinstance(obj, Component):
component = obj
if component is not None and component.is_glossary:
Expand Down
2 changes: 1 addition & 1 deletion weblate/checks/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
PLAIN_FLAGS["auto-java-messageformat"] = gettext_lazy(
"Automatically detect Java MessageFormat"
)
PLAIN_FLAGS["read-only"] = gettext_lazy("Read only")
PLAIN_FLAGS["read-only"] = gettext_lazy("Read-only")
PLAIN_FLAGS["strict-same"] = gettext_lazy("Strict unchanged check")
PLAIN_FLAGS["strict-format"] = gettext_lazy("Strict format string checks")
PLAIN_FLAGS["forbidden"] = gettext_lazy("Forbidden translation")
Expand Down
2 changes: 1 addition & 1 deletion weblate/formats/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def has_content(self) -> bool:
return True

def is_readonly(self) -> bool:
"""Check whether unit is read only."""
"""Check whether unit is read-only."""
return False

def set_target(self, target: str | list[str]) -> None:
Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/snippets/unit-readonly-badge.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
{% elif unit.is_source %}
<span class="badge" title="{% trans "The source string cannot be edited." %}">{% trans "Source string" %}</span>
{% else %}
<span class="badge">{% trans "Read only" %}</span>
<span class="badge">{% trans "Read-only" %}</span>
{% endif %}
{% endif %}
2 changes: 1 addition & 1 deletion weblate/templates/translate.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ <h4 class="panel-title">
type="submit"
name="suggest"
{% if project_locked or not user_can_suggest or unit.readonly %}disabled="disabled"{% endif %}
{% if not user_can_suggest %} title="{% trans "Insufficient privileges for adding suggestions." %}" {% elif project_locked %} title="{% trans "This translation is currently locked." %}" {% elif unit.readonly %} title="{% trans "Read only" %}" {% endif %}>
{% if not user_can_suggest %} title="{% trans "Insufficient privileges for adding suggestions." %}" {% elif project_locked %} title="{% trans "This translation is currently locked." %}" {% elif unit.readonly %} title="{% trans "Read-only" %}" {% endif %}>
{% icon "suggest.svg" %} {% trans "Suggest" %}
</button>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions weblate/trans/migrations/0001_squashed_weblate_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ class Migration(migrations.Migration):
(10, "Needs editing"),
(20, "Translated"),
(30, "Approved"),
(100, "Read only"),
(100, "Read-only"),
],
default=0,
),
Expand All @@ -1042,7 +1042,7 @@ class Migration(migrations.Migration):
(10, "Needs editing"),
(20, "Translated"),
(30, "Approved"),
(100, "Read only"),
(100, "Read-only"),
],
default=0,
),
Expand Down
4 changes: 2 additions & 2 deletions weblate/trans/models/unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,15 +685,15 @@ def get_unit_state(self, unit, flags: str | None, string_changed: bool = False):
return STATE_READONLY

if flags is not None:
# Read only from the source
# Read-only from the source
if (
not self.is_source
and self.source_unit.state < STATE_TRANSLATED
and self.translation.component.intermediate
):
return STATE_READONLY

# Read only from flags
# Read-only from flags
if "read-only" in self.get_all_flags(flags):
return STATE_READONLY

Expand Down
2 changes: 1 addition & 1 deletion weblate/trans/tests/test_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ def test_readonly(self) -> None:
self.component.edit_template = False
self.component.save()

# It should be now read only
# It should be now read-only
self.assertEqual(source.unit_set.all()[0].state, STATE_READONLY)


Expand Down
2 changes: 1 addition & 1 deletion weblate/utils/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class StringState(IntegerChoices):
STATE_FUZZY = 10, pgettext_lazy("String state", "Needs editing")
STATE_TRANSLATED = 20, pgettext_lazy("String state", "Translated")
STATE_APPROVED = 30, pgettext_lazy("String state", "Approved")
STATE_READONLY = 100, pgettext_lazy("String state", "Read only")
STATE_READONLY = 100, pgettext_lazy("String state", "Read-only")


STATE_EMPTY = StringState.STATE_EMPTY
Expand Down

0 comments on commit fb8534d

Please sign in to comment.