Ask Your Question

dealing with %(question)s in translation

asked 2014-10-21 08:21:35 -0600

paolini's avatar

updated 2014-10-21 08:28:46 -0600

Using the replacement "%(question)s" is not good with italian translations. In fact italian words may have different genres which should translate differently. Also there are issue with singular/plural since sometimes the translation would use a plural name where the english original uses singular.

As an example:

  "write a question"  -> "scrivi una domanda" (feminine)   
  "write a message"  -> "scrivi un messaggio" (masculine)
  "latest question feed"  -> "feed ultimi messaggi" (pluralization)

Maybe substitution marks should never contain localized text. I would replace something like:

_("Individual %(question)s feed") % _(question)


{'question': "Individual question feed",
 'answer': "Individual answer feed"}[question]

BTW What is the context of the message "individual %(question)s feed"? "individual" refers to question or to feed?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-10-23 16:48:12 -0600

Evgeny's avatar

This form is used in the following context:

_('Individual %(question)s feed') % {'question': askbot_settings.WORDS_QUESTION_SINGULAR}

And the purpose is to replace the word "question" with something else, such as "problem". If such replacement does not work in Italian, then we might need to add yet another parametrizable phrase to the askbot.conf.words module.

edit flag offensive delete link more


In italian it is not possible to parametrize a phrase on a noun... Both "question" and "problem" have the same gender so I have a solution working for these two. But other nouns such as "message" or "comment" have different genre hence the phrase containing them would be different. In general the complete phrase should be parametrized.

paolini's avatar paolini  ( 2014-10-24 05:15:19 -0600 )edit

However I think that the best solution would be to remove WORDS_QUESTION_SINGULAR from the configurable settings. Seems to me that it would be fine to modify the source code for such a customization. It is something very similar to the modification of a template... you cannot parametrize all possible HTML layouts in the configuration settings. Maybe one could think of some kind of "skin" package which can be plugged in to override templates and also translation strings?

paolini's avatar paolini  ( 2014-10-24 05:31:05 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-10-21 08:21:35 -0600

Seen: 242 times

Last updated: Oct 23 '14