Skip to content Skip to sidebar Skip to footer

Django Translation Reverse

Is it possible to get msgid from msgstr? Suppose I have msgid 'Table' msgstr 'Tisch' If active language is German is there any function to execute inverse_ugettext('Tisch') ->

Solution 1:

No, it's not trivially possible. At least not with the django i18n implementation (which uses python's gettext).

If you really need this, you'll have to manually implement it somehow (the gettext source might be a useful starting place).

If speed is not critical here (eg: it's a very infrequent operation), you might want to parse the .po files, which are a lot simpler to parse, and find the reverse there.

Post a Comment for "Django Translation Reverse"