Different fashions of time expressions
Thomas De Schampheleire
patrickdepinguin at gmail.com
Sat May 9 15:30:40 EDT 2015
On Sat, May 9, 2015 at 9:11 PM, Vitt2, Peter <peter.vitt2 at uni-siegen.de> wrote:
> It’s me again with a translation “problem”. I came across the string "%(user)s commented on changeset at %(when)s” which looks quite simple to translate. But in german we decide between a date “Am 8. Mai” and a time “Um 13:47 Uhr”, so I wanted to check what kind of string is used to replace "%(when)s". This particular string is used in kallithea/model/notification.py:252, and in lines 261 the time string is created. The problem here is that the string can be a timespan since the comment was submitted and the exact point in time of the comment. Which removes one possible translation, but brings another into play. Now I have to decide between “Am 2015-05-08 13:47:23” und “Vor 3 Tagen und 17 Stunden”.
> Which of the two time strings is used can be controlled with a function parameter, but the format string to be used is independent from this parameter. Which leads me to the question: Is it wise to adapt the code to translation needs, which is: Make the format string also depending on the show_age parameter? Or should we just live with bulky translations (which somehow destroys the benefit of having the possibility to decide between different time fashions)?
In this case I think the format string should be different depending
on the show_age parameter.
The current English text says:
user commented on changeset AT <when>
which is fine when <when> is indeed a precise time. But when it is an
age, the AT is not correct:
user comment on changeset at 3 days ago.
So here the 'at' should be removed.
I wonder how we can make this difference obvious to translators. I
guess the only way is to change the format string identifier to 'when'
when it's a precise time, and 'age' (or something similar) when it's
Both values can be passed in all cases (thus removing the current if
to determine 'when'). The 'map' would be different depending on
show_age and would thus use either 'when' or 'age'.
More information about the kallithea-general