Skip to content

Commit

Permalink
Add supports plural condition for the plural form
Browse files Browse the repository at this point in the history
  • Loading branch information
harriebird authored and nijel committed Jul 15, 2024
1 parent f636679 commit 30e4e58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions weblate/templates/translation.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,19 @@ <h4 class="panel-title">
<label class="radio-inline">
<input type="radio" name="new-unit-form-type" id="show-singular" value="singular" checked> {% trans "Singular" %}
</label>
<label class="radio-inline">
<input type="radio" name="new-unit-form-type" id="show-plural" value="plural"
{% if object.plural.number < 2 %} disabled{% endif %}> {% trans "Plural" %}
</label>
{% if supports_plural and object.plural.number > 1 %}
<label class="radio-inline">
<input type="radio" name="new-unit-form-type" id="show-plural" value="plural"> {% trans "Plural" %}
</label>
{% endif %}
</div>
<div class="panel-footer">
<input type="submit" value="{% trans "Add" %}" class="btn btn-primary" />
</div>
</div>
</form>
</div>
{% if object.plural.number > 1 %}
{% if supports_plural and object.plural.number > 1 %}
<div id="new-plural" class="hidden">
<form action="{% url 'new-unit' path=object.get_url_path %}" method="post">
<div class="panel panel-default">
Expand Down
1 change: 1 addition & 0 deletions weblate/trans/views/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ def show_translation(request, obj):
"object": obj,
"project": project,
"component": obj.component,
"supports_plural": component.file_format_cls.supports_plural,
"form": form,
"download_form": DownloadForm(obj, auto_id="id_dl_%s"),
"autoform": optional_form(
Expand Down

0 comments on commit 30e4e58

Please sign in to comment.