Search code examples
gettext

How do you escape a dollar sign in gettext .po file?


This is the first question I've asked here, so please be kind...

In my PO file, I have a localized string that contains a dollar sign. I have not been able to escape the dollar sign (to avoid gettext's attempt at dollar-substitution) with the desired results. An example PO entry to clarify what I'm trying to do:

msgid "myStringId"
msgstr "My string that contains a $ sign"

gettext throws up on the $ in the msgtr. I've tried escaping using the following approaches:

msgstr "My string that contains a \$ sign"
msgstr "My string that contains a $$ sign"
msgstr "My string that contains a '$' sign"

...without success. The third approach (single quotes) gets the closest, but returns the dollar sign and the single quotes.

returned => My string that contains a '$' sign
desired => My string that contains a $ sign

My question again: How do you escape dollar signs in gettext PO entries?

Thanks in advance.


Solution

  • I haven't tried, but how about using C's octal escaping \044 or the unicode one \u0024?