appstore icon indicating copy to clipboard operation
appstore copied to clipboard

Bad i18n on button for downloading an app release

Open PFischbeck opened this issue 5 years ago • 4 comments

When visiting the releases page for some app, .e.g,, the calendar app, the button to download that version is phrased incorrectly in German: German download button It reads "Herunterladen Calendar 1.7.2", but should be "Calendar 1.7.2 herunterladen". However, I can not fix this in the translations, because the corresponding code uses trans instead of blocktrans. https://github.com/nextcloud/appstore/blob/1cbe9eb06c3ff19b36e8b7b49771e24cf30d2dbb/nextcloudappstore/core/templates/app/releases.html#L86

PFischbeck avatar Jan 16 '20 17:01 PFischbeck

@PFischbeck can you create a PR, thanks!

BernhardPosselt avatar Jan 16 '20 17:01 BernhardPosselt

This turns out to be harder than expected... I would like to use a kind of nested translation - I have the following as a block:

{{ object.name }} {{ release.version }}{% if release.is_nightly %} ({% trans 'nightly' %}) {% endif %} 

I want the result of that in a variable release_name, which could then be used like this:

{% blocktrans %}
Download {{ release_name }}
{% endblocktrans %}

However, the first step (saving the result of this block in a variable) is not really possible in vanilla Django. Does anyone see a nice way of doing this?

PFischbeck avatar Jan 19 '20 21:01 PFischbeck

It is, check https://stackoverflow.com/questions/1070398/how-to-set-a-value-of-a-variable-inside-a-template-code

BernhardPosselt avatar Jan 20 '20 09:01 BernhardPosselt

@BernhardPosselt Do you mean the with template tag? I don't understand how I would assign the complex block from above to the variable release_name, since this includes concatenation, an if, and a translation. The same holds for the blocktrans with template tag, leading to this problem:

{% blocktrans with release_name=??? %}
Download {{ release_name }}
{% endblocktrans %}

What to put in place of the question marks? Or should I add a custom template tag for this release name generation?

PFischbeck avatar Feb 09 '20 16:02 PFischbeck