Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8768203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:00:48+00:00 2026-06-13T17:00:48+00:00

I am deploying a single Django project for managing a certain kind of an

  • 0

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 sites 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.

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.

For example, consider the following piece of template code:

<link rel="alternate" type="application/atom+xml" title="Novinky pre {{ site.name }}" href="{% url "news_feed" %}" />

site.name 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.

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.

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:00:49+00:00Added an answer on June 13, 2026 at 5:00 pm

    As @jpic says, you could do it with contextual markers. It would actually be simpler with the site name embedded in the template, as then it would be picked up by django’s makemessages.

    <link rel="alternate" type="application/atom+xml" 
          title="Novinky pre {% trans 'Akadémia Trojstenu' context '4th' %}" 
          href="{% url "news_feed" %}" />
    

    Since that is probably not simple with multiple sites, you could instead make an extra .po file and manually enter all the site names and their translations and context names.

    This is sort of error-prone, as you’re manually synchronizing a translation file and some database values, but at least it’s all in one place and outside the templates.

    msgctxt "1st"
    msgid "Akadémia Trojstenu"
    msgstr "Akadémia Trojstenu"
    
    msgctxt "2nd"
    msgid "Akadémia Trojstenu"
    msgstr "????? Trojstenu"
    
    msgctxt "3rd"
    msgid "Akadémia Trojstenu"
    msgstr "Akadémie Trojstenu"
    
    msgctxt "4th"
    msgid "Akadémia Trojstenu"
    msgstr "Akadémiu Trojstenu"
    
    ...
    
    msgctxt "3rd"
    msgid "Klub Trojstenu"
    msgstr "Klubu Trojstenu"
    
    ...
    

    Stick the extra .po in another directory and register the directory in the LOCALE_PATHS setting. Remember you did this, so you know where to look when someone adds a new site or changes the name of one and starts wondering why the translations are broken.

    With this done, you should be able to use the site name like this:

    <link rel="alternate" type="application/atom+xml" 
          title="Novinky pre {% trans site.name context '4th' %}" 
          href="{% url "news_feed" %}" />
    

    Of course, if the problem is limited to just the site name, you might instead stick a few more fields on your Site model to hold the other cases (subclass it). Since site objects never really change, I don’t think this sort of denormalization would cause any trouble.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a solution with a single project file. I am deploying as a
I'm deploying an app to GAE. I have a single project setup in Eclipse,
When deploying a web project written in ASP.Net, what happens to user sessions? Do
I have built a setup project for deploying my windows forms app. I want
Is there a way to deploy changes to a single code-behind file when using
I have never actually worked for a company which is deploying a Django App
Deployment on other computers works fine. Deploying on a single webserver works fine but
I am building a simple mono android project and deploying to the emulator. Every
Will deploying a mysql cluster speed up a single join-query on a large set
When promoting or deploying a build, I'd like to automate swapping out a single

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.