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
My开发者_StackOverflow中文版 string that contains a $ sign
My question again: How do you escape dollar signs in gettext PO entries?
Thanks in advance.
I haven't tried, but how about using C's octal escaping \044
or the unicode one \u0024
?
I found out that I could just replace my $ with its HTML entity code. https://stackoverflow.com/a/10225521/470749 For $5, I now write $5
精彩评论