Search code examples
gettextpo

Does PO file format support negative indexes?


I have a source format that has negative indexes:

@-1002= "What should be done with all components that are NOT YET installed?\n[I]nstall them, [S]kip them, [A]sk about each one?"

@-1003= "What should be done with all components that are ALREADY installed?\n[R]e-install them, [U]ninstall them, [S]kip them, [A]sk about each one? "

Does PO file format support negative indexes or any other way to be able to have those strings included?


Solution

    1. PO file format does not support negative indexes. The PO file format is a plain text format that is used to store translation data.

    2. If you have source format that has negative indexes, you'll need to convert them to positive integers before you can store them in a PO file.

      • use abs() function to return absolute value of a number

      • if you want to use %s in the msgstr, you'll need to convert the PO file to different format, such as gettext format. To convert PO file to the gettext format, you can use the following command

        msgfmt -o output.po input.po