Note that there are some explanatory texts on larger screens.

plurals
  1. POGrammatical cases in multi-site Django deployments
    text
    copied!<p>I am deploying a single Django project for managing a certain kind of an event. There are two deployments with a single database, the sites are in Slovak. They are for events called „Akadémia Trojstenu“ and „Klub Trojstenu“. The simple part is I can just use the <code>sites</code> framework, set the display name for each site accordingly and use that in my templates where I need to refer to the name of the event.</p> <p>This looks all right up until you realize the Slovak language uses grammatical cases. That means, in some places I need to write „Program Akadémie Trojstenu“ / „Program Klubu Trojstenu“ or „Staré Akadémie“ / „Staré Kluby“ for example.</p> <p>For example, consider the following piece of template code:</p> <pre><code>&lt;link rel="alternate" type="application/atom+xml" title="Novinky pre {{ site.name }}" href="{% url "news_feed" %}" /&gt; </code></pre> <p><code>site.name</code> contains „Akadémia Trojstenu“, but in this case I need it to output „Novinky pre Akadémiu Trojstenu“, i.e. the content of the variable in the fourth grammatical case.</p> <p>The only way forward I see at this moment is to special-case all such occurrences in the templates, look at the current site's domain and output the correct grammatical case of the name. This solution is obviously heavily anti-DRY, hideous and will eat small children.</p> <p>Does anyone have a better suggestion? Is there some kind of standard solution? I imagine there are lots of languages using grammar cases and there's certainly someone who encountered this problem before me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload