Skip to content

German localisation should be improved #48

@Luflosi

Description

@Luflosi

What did you do?

Execute

import humanize
import datetime as dt
_t = humanize.i18n.activate("de_DE")
humanize.naturaltime(dt.datetime.now() - dt.timedelta(seconds=3600))

What did you expect to happen?

I would expect the output to be 'vor einer Stunde'.

What actually happened?

The output was 'vor eine Stunde', which is grammatically incorrect.
"one hour" translates to "eine Stunde" but "one hour ago" translates to "vor einer Stunde". I think 1 is the only number where this special case happens.

What versions are you using?

  • OS: macOS 10.15.7
  • Python: 3.10.5
  • Humanize: 4.2.3

Overall the support for German seems a bit lacking.
For example the . and , in numbers are swapped compared to what's common in English, which this library doesn't support (humanize.intcomma(12345) for example).
humanize.intword(123455913) outputs 123.5 Million but Million is singular. The correct output with a plural would be 123.5 Millionen, since 123.5 is more than 1 (actually I think it's correct to always use the plural when the value is not exactly equal to 1).

Is this something you think would be worthwhile to improve? I could help you by trying to find more of these problems, testing patches or even writing some fixes myself if you help me a bit. I'm afraid if I just mess around in the translation file, I'll fix some specific problem I found but break other cases I didn't think about.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions