Search code examples
pythoninternationalizationmultilingualgettext

gettext usage for 2 strings that are the same


Is there a more compact way if I want 2 keys have the same value? This works:

msgid "Next"
msgstr "Pág. seguinte"

msgid "Next page"
msgstr "Pág. seguinte"

I could imagine writing it like this instead but is it legal?

msgid "Next", "Next page"
msgstr "Pág. seguinte"

I have more questions about gettext, what do you recommend? I.e. how to do with html in translations and escape characters.


Solution

  • i think best option is split words in code like:

    a = _('next')
    b = '%s %s' % ( _('next'), _('page') )
    

    and in .po

    msgid "Next"
    msgstr "seguinte"
    msgid "page"
    msgstr "Pág."
    

    why you need to translate html special characters ? For example, © on all languages ©