python-humanize / python-humanize/humanize
German requires different cases for ‘%s ago’ and ‘%s from now’
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 756
- Forks
- 148
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 12
Description
This is somewhat related to #88 , but hasn’t been resolved and also needs changes to more than the translation files I am afraid.
So what this is about is that German grammar is a beast, and prepositions require certain cases. For instance, ’vor‘ will need a dativ. ‘an hour ago’ thus translates into ‘vor einer Stunde‘, rather than ‘vor eine Stunde‘ (that’s nominativ).
humanize forms the expression ‘an hour ago‘ by piping the output of naturaldelta straight into the i18n format string for %s ago. naturaldelta() returns a nominativ, that is correct as long as the expression stands by itself. However, as soon as a preposition is placed in front of the value, the grammatical case should change.
(The same is true for ‘in ...’/‘... from now’(which currently translates into ‘... ab jetzt’ which sounds odd). Conveniently, both ‘in’ and ‘vor’ require the same case, dativ)
I would be happy to contribute, but I do not know where to start without breaking things big time. If anybody can give me some directions of how to implement this best, I would go ahead and dig my head in
I don’t properly speak any Slavic languages, but I would expect similar issues with those (correct me if I am wrong)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/humanize/time.py around the naturaldelta() output and the i18n format string for “%s ago.” Trace how the German translations for past and future expressions are assembled, then determine how the required dative forms can be represented without breaking other locales. Done means German “ago” and “from now” expressions use the correct case while existing translations remain valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- localization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100