Write a function to make the genitiv:
def genitiv(name):
if name[-1]=='s':
return _(u"%s'" % name)
else:
return _(u"%s's" % name)
Question
I want to translate a text into German but I have trouble with the genitive 's. In German, we don't have an inverted comma after the genitive ("John's car" -> "Johns Auto" (Auto is German for car)) except the word ends with an s ("James's car" -> "James' Auto"). So, if I have the following:
_("%(name)'s car is nice") % name
The results for "John" and "James" are:
John's car is nice -> Correct
Johns Auto ist schön -> Correct (ist means is and schön means nice or beautiful).
James's car is nice -> Correct
Jamess Auto is schön -> Wrong it has to be James'
Since I'm the developer of the program, I can also update the source code and add new functions.
Solution
Write a function to make the genitiv:
def genitiv(name):
if name[-1]=='s':
return _(u"%s'" % name)
else:
return _(u"%s's" % name)