diff --git a/docs/changes.rst b/docs/changes.rst index 023a7e6f058a..3c8ba5c25dc1 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -20,6 +20,7 @@ Not yet released. * :ref:`autofix` for French and Breton now uses a non-breaking space before colons instead of a narrow one. * :ref:`api` now has a preview OpenAPI specification. * :kbd:`?` now displays available :ref:`keyboard`. +* Translation and language view in the project now include basic information about the language and plurals. **Bug fixes** diff --git a/weblate/templates/language-project.html b/weblate/templates/language-project.html index 644155b464ce..4d3ed9702639 100644 --- a/weblate/templates/language-project.html +++ b/weblate/templates/language-project.html @@ -86,7 +86,7 @@
- {% show_info project=project stats=language_stats metrics=object|metrics %} + {% show_info project=project language=language stats=language_stats metrics=object|metrics show_full_language=False %}
diff --git a/weblate/templates/snippets/git-info.html b/weblate/templates/snippets/git-info.html index 50887c34c200..f31f2fd5f87f 100644 --- a/weblate/templates/snippets/git-info.html +++ b/weblate/templates/snippets/git-info.html @@ -8,7 +8,7 @@ {% if user_can_see_git_repository %} {% trans "Source code repository" %} - + {% with repo_url=object.get_repo_url %} {% if repo_url|slice:":8" == "https://" %} {{ repo_url }} @@ -25,7 +25,7 @@ {% trans "Repository branch" %} - + {{ object.get_repo_branch }} @@ -34,7 +34,7 @@ {% if commit %} {% trans "Last remote commit" %} - + {{ commit.summary }} {{ commit.shortrevision }} @@ -50,7 +50,7 @@ {% if commit %} {% trans "Last commit in Weblate" %} - + {{ commit.summary }} {{ commit.shortrevision }} @@ -66,7 +66,7 @@ {% if export_url %} {% trans "Weblate repository" %} - + {{ export_url }} diff --git a/weblate/templates/snippets/info.html b/weblate/templates/snippets/info.html index 64b43a34ec74..6d8b08131650 100644 --- a/weblate/templates/snippets/info.html +++ b/weblate/templates/snippets/info.html @@ -12,85 +12,18 @@

{% trans "Overview" %}

- {% if language %} - - - - - {% with aliases=language.get_aliases_names %} - {% if aliases %} - - - - - {% endif %} - {% endwith %} - - - - - {% if language.population %} - - - - - {% endif %} - {% for plural in language.plural_set.order %} - - - - - - - - - - - - - - {% if plural.number > 1 %} - {% for item in plural.list_plurals %} - {% if item.index > 1 %} - - {% endif %} - - - - {% endfor %} - {% else %} - - - {% endif %} - - - - - {% endfor %} - {% endif %} {% if project %} {% if project.web %} - + {% endif %} {% if project.instructions %} - + {% endif %} @@ -100,7 +33,7 @@ {% if project.billings %} - - - - + {% endfor %} {% endif %} @@ -149,7 +82,7 @@ {% if component.license %} - - - - + {% if component.template %} - + {% endif %} {% endif %} @@ -227,7 +160,7 @@ {% if translation %} - - + - + + + {% endif %} + {% if language %} + {% if not show_full_language %} + + + + {% endif %} + + + + + {% if show_full_language %} + {% with aliases=language.get_aliases_names %} + {% if aliases %} + + + + + {% endif %} + {% endwith %} + {% endif %} + + + + {% if language.population %} + + + + + {% endif %} + {% if show_full_language %} + {% for plural in language.plural_set.order %} + {% include "snippets/plural.html" %} + {% endfor %} + {% elif translation %} + {% include "snippets/plural.html" with plural=translation.plural %} + {% endif %} {% endif %}
{% trans "Language code" %} - {% if user_can_edit_language %} - {% trans "Edit" %} - {% endif %} - {{ language.code }} -
{% trans "Aliased language codes" %}{{ aliases|join:", " }}
{% trans "Text direction" %}{{ language.get_direction_display }}
{% trans "Number of speakers" %}{{ language.population|intcomma }}
- {% if user_can_edit_language %} - {% trans "Edit" %} - {% endif %} - {% blocktrans with source_description=plural.get_source_display %}Plural: {{ source_description }}{% endblocktrans %} - {% blocktrans count count=plural.translation_set.count %}{{ count }} translation{% plural %}{{ count }} translations{% endblocktrans %} -
{% trans "Number of plurals" %}{{ plural.number }}
{% trans "Plural type" %}{{ plural.get_type_display }}
{% trans "Plurals" %}
{{ item.name }}{{ item.examples }}
{% trans "Plural formula" %}{{ plural.formula }}
{% trans "Project website" %}{{ project.web | urlformat }}{{ project.web | urlformat }}
{% trans "Instructions for translators" %}{{ project.instructions|markdown }}{{ project.instructions|markdown }}
{% trans "Billing" %} + {% for billing in project.billings %} {% include "billing/state-snippet.html" with object=billing %} @@ -114,7 +47,7 @@ {% if project.all_admins %}
{% trans "Project maintainers" %} + {% for admin in project.all_admins %} {{ admin.profile.get_user_display_link }} {% endfor %} @@ -126,7 +59,7 @@ {% regroup licenses by license as license_list %}
{% trans "Translation license" %} + {% for dummy, items in license_list %} {{ items.0.license_badge }} {% for component in items %} @@ -140,7 +73,7 @@ {% for auto in componentlist.autocomponentlist_set.all %}
{%if forloop.first%}{% trans "Automatic component list assignment" %}{% endif %}project ~= {{ auto.project_match }}, component ~= {{ auto.component_match }}project ~= {{ auto.project_match }}, component ~= {{ auto.component_match }}
{% trans "Translation license" %} + {% if component.license_url %} {{ component.get_license_display }} {% else %} @@ -162,7 +95,7 @@ {% if component.agreement %}
{% trans "Contributor agreement" %} + {% if user.is_authenticated %} {% trans "View" %} {% endif %} @@ -173,7 +106,7 @@
{% trans "Translation process" %} +
    {% get_workflow_flags translation component as workflow_flags %} {% if workflow_flags.suggestion_voting and workflow_flags.suggestion_autoaccept %} @@ -213,13 +146,13 @@
{% trans "File mask" %}{{ component.filemask }}{{ component.filemask }}
{% trans "Monolingual base language file" %}{{ component.template }}{{ component.template }}
{% trans "Translation file" %} + {% if translation.filename %} {% trans "Download" %} {{ translation.filename }} @@ -238,12 +171,58 @@
{% trans "Last change" %}{{ stats.last_changed }}{{ stats.last_changed }}
{% trans "Last author" %}{{ translation.get_last_author }}{{ translation.get_last_author }}
{% trans "Language" %} + {{ language }} + +
{% trans "Language code" %} + {% if user_can_edit_language %} + {% trans "Edit" %} + {% endif %} + {{ language.code }} +
{% trans "Aliased language codes" %}{{ aliases|join:", " }}
{% trans "Text direction" %}{{ language.get_direction_display }}
{% trans "Number of speakers" %}{{ language.population|intcomma }}
diff --git a/weblate/templates/snippets/plural.html b/weblate/templates/snippets/plural.html new file mode 100644 index 000000000000..a0cd92b5d9ed --- /dev/null +++ b/weblate/templates/snippets/plural.html @@ -0,0 +1,40 @@ +{% load i18n %} + +{% if show_full_language %} + + + {% if user_can_edit_language %} + {% trans "Edit" %} + {% endif %} + {% blocktrans with source_description=plural.get_source_display %}Plural: {{ source_description }}{% endblocktrans %} + {% blocktrans count count=plural.translation_set.count %}{{ count }} translation{% plural %}{{ count }} translations{% endblocktrans %} + + +{% endif %} + + {% trans "Number of plurals" %} + {{ plural.number }} + + + {% trans "Plural type" %} + {{ plural.get_type_display }} + + +{% trans "Plurals" %} +{% if plural.number > 1 %} + {% for item in plural.list_plurals %} + {% if item.index > 1 %} + + {% endif %} + {{ item.name }} + {{ item.examples }} + + {% endfor %} +{% else %} + + +{% endif %} + + {% trans "Plural formula" %} + {{ plural.formula }} + diff --git a/weblate/templates/translation.html b/weblate/templates/translation.html index fd4fb9668642..6261e381ed5c 100644 --- a/weblate/templates/translation.html +++ b/weblate/templates/translation.html @@ -222,7 +222,7 @@

- {% show_info project=object.component.project component=object.component translation=object stats=object.stats metrics=object|metrics %} + {% show_info project=object.component.project component=object.component translation=object language=object.language stats=object.stats metrics=object|metrics show_full_language=False %}
diff --git a/weblate/trans/templatetags/translations.py b/weblate/trans/templatetags/translations.py index df2ab1166e83..ab26e771ff1d 100644 --- a/weblate/trans/templatetags/translations.py +++ b/weblate/trans/templatetags/translations.py @@ -1506,6 +1506,7 @@ def show_info( metrics: MetricsWrapper | None = None, show_source: bool = False, show_global: bool = False, + show_full_language: bool = True, ): """ Render project information table. @@ -1523,4 +1524,5 @@ def show_info( "metrics": metrics, "show_source": show_source, "show_global": show_global, + "show_full_language": show_full_language, }