Idea: cases in pygettext

    In Russian, in order to get an acceptable translation, one needs to incline nouns and adjectives when substituting. Gettext by itself does not know how to do this (except for numerals), but it seems that in python this limitation can be circumvented.

    To do this, add a case index in the translation lines, for example:
    “Delete% s [in]” - “in” in square brackets indicates the accusative case.

    Well, in the substituted words themselves, you need to specify the endings for all cases, for example:
    verbose_name = u “become [I, and, e, u, she, e]”

    Next, you need to modify the gettext and ngettext functions so that they instead return a special unicode object an object in which the __mod__ method substitutes the values ​​in the desired case.

    With the latter, I still have questions, since I want to apply this in Django, and I don’t know yet where (django.utils.translation?) To insert it.

    Thank you in advance for your comments. Even better - if this bike already exists somewhere.

    Also popular now: