Edgewall Software
Modify

Opened 3 years ago

Last modified 14 months ago

#13430 new defect

Translation of past time expressions

Reported by: anonymous Owned by:
Priority: normal Milestone: 1.6.1
Component: i18n Version: 1.4
Severity: normal Keywords: time hungarian
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

If someone comments on a ticket, the timestamp is stored and gives a human-readable output when was something made. It's a great feature, but it seems the time parts are translated separately.

Example:

2 months ago appears, and translated as 2 <months> <ago>. However, in Hungarian (possibly many more languages), the months and ago can't be translated separately, because it's an expression.

I suggest merging the two translation units into one because the current implementation results in mixed translations.

Possibly there are other places than comments when this appears, but I don't know Trac well enough to tell all of them :(

Attachments (0)

Change History (5)

comment:1 by Jun Omae, 3 years ago

Milestone: 1.5.4

Interested. In Trac, the relative times are translated like this:

en hu
2 months 2 hónap
2 months ago 2 hónap ezelőtt (should be "2 hónappal ezelőtt")

I think we could use format_timedelta(delta, add_direction=True) (add_direction argument is introduced in Babel 1.0).

Locale Past Future
ca 2 mesos fa 2 mesos 2 mesos d’aquí a 2 mesos
cs 2 měsíce před 2 měsíci 2 měsíce za 2 měsíce
da 2 måneder for 2 måneder siden 2 måneder om 2 måneder
de 2 Monate vor 2 Monaten 2 Monate in 2 Monaten
el 2 μήνες πριν από 2 μήνες 2 μήνες σε 2 μήνες
en_GB 2 months 2 months ago 2 months in 2 months
en_US 2 months 2 months ago 2 months in 2 months
eo 2 monatoj antaŭ 2 monatoj 2 monatoj post 2 monatoj
es 2 meses hace 2 meses 2 meses dentro de 2 meses
es_AR 2 meses hace 2 meses 2 meses dentro de 2 meses
es_MX 2 meses hace 2 meses 2 meses en 2 meses
et 2 kuud 2 kuu eest 2 kuud 2 kuu pärast
fa 2 ماه 2 ماه پیش 2 ماه 2 ماه بعد
fi 2 kuukautta 2 kuukautta sitten 2 kuukautta 2 kuukauden päästä
fr 2 mois il y a 2 mois 2 mois dans 2 mois
gl 2 meses Hai 2 meses 2 meses En 2 meses
he חודשיים לפני חודשיים חודשיים בעוד חודשיים
hu 2 hónap 2 hónappal ezelőtt 2 hónap 2 hónap múlva
hy 2 ամիս 2 ամիս առաջ 2 ամիս 2 ամիս անց
it 2 mesi 2 mesi fa 2 mesi tra 2 mesi
ja 2 か月 2 か月前 2 か月 2 か月後
ko 2개월 2개월 전 2개월 2개월 후
nb 2 måneder for 2 måneder siden 2 måneder om 2 måneder
nl 2 maanden 2 maanden geleden 2 maanden over 2 maanden
pl 2 miesiące 2 miesiące temu 2 miesiące za 2 miesiące
pt 2 meses há 2 meses 2 meses em 2 meses
pt_BR 2 meses há 2 meses 2 meses em 2 meses
ro 2 luni acum 2 luni 2 luni peste 2 luni
ru 2 месяца 2 месяца назад 2 месяца через 2 месяца
sl 2 meseca pred 2 mesecema 2 meseca čez 2 meseca
sq 2 muaj 2 muaj më parë 2 muaj pas 2 muajsh
sv 2 månader för 2 månader sedan 2 månader om 2 månader
tr 2 ay 2 ay önce 2 ay 2 ay sonra
uk 2 місяці 2 місяці тому 2 місяці через 2 місяці
vi 2 tháng 2 tháng trước 2 tháng sau 2 tháng nữa
zh_CN 2个月 2个月前 2个月 2个月后
zh_TW 2 個月 2 個月前 2 個月 2 個月後

The table is generated by the following code:

>>> import babel
>>> babel.__version__
'2.2.0'
>>> from datetime import timedelta
>>> locales = 'ca cs da de el en_GB en_US eo es es_AR es_MX et fa fi fr gl he hu hy it ja ko nb nl pl pt pt_BR ro ru sl sq sv tr uk vi zh_CN zh_TW'.split()
>>> for locale in locales:
...    delta = timedelta(days=2 * 30)
...    print('|| %s || %s || %s || %s || %s ||' %
...          (locale,
...           format_timedelta(-delta, locale=locale),
...           format_timedelta(-delta, add_direction=True, locale=locale),
...           format_timedelta(+delta, locale=locale),
...           format_timedelta(+delta, add_direction=True, locale=locale)))
...

in reply to:  1 ; comment:2 by anonymous, 3 years ago

Replying to Jun Omae:

Interested. In Trac, the relative times are translated like this:

en hu
2 months 2 hónap
2 months ago 2 hónap ezelőtt (should be "2 hónappal ezelőtt")

The current Hungarian translation is a mixed half English, half Hungarian 2 hónapja ago. See it in Trac 1.4 demo.

Just to confirm, the correct translation would be 2 hónappal ezelőtt.

Thank you for looking into this!

in reply to:  2 comment:3 by Jun Omae, 3 years ago

The current Hungarian translation is a mixed half English, half Hungarian 2 hónapja ago. See it in Trac 1.4 demo.

That is due to missing translation in Hungarian catalog at source:/tags/trac-1.4.3/trac/locale/hu/LC_MESSAGES/messages.po#L4641.

The following patch fixes the mixed half English.

 #: trac/timeline/web_ui.py:301 trac/web/chrome.py:871
-#, fuzzy, python-format
+#, python-format
 msgid "%(relative)s ago"
-msgstr ""
+msgstr "%(relative)s ezelőtt"
Last edited 3 years ago by Jun Omae (previous) (diff)

comment:4 by Ryan J Ollos, 2 years ago

Milestone: 1.5.41.5.5

comment:5 by Jun Omae, 14 months ago

Milestone: 1.5.51.6.1

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.