4

How can keywords be escaped when passing the --keyword argument? We use static calls to fetch translations, i.e. in the form Language::getText('foo');

c0dem4gnetic
  • 932
  • 1
  • 7
  • 24

2 Answers2

4

I was looking for a solution to this as well; it looks (to my non-C-programming eyes) like xgettext uses colons as a separator internally. According to a comment in the code, "The characters between name and end should form a valid C identifier. A colon means an invalid parse in split_keywordspec()." So it's basically dumping anything with a colon in it as invalid.

miken32
  • 42,008
  • 16
  • 111
  • 154
  • Source in the *documentation*: https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html#Language-specific-options – caw Feb 01 '19 at 22:00
2

I’m afraid you only have three options:

  1. Write your own custom tool to extract strings from this sort of code.
  2. Realize you are using a gettext library that has certain ways of doing thing and use it as it was intended to be used, i.e. with some sane, simple function or macro instead of a verbose Language::getText method call.
  3. Add support for this to xgettext and submit a patch to GNU gettext project.
Václav Slavík
  • 6,445
  • 2
  • 28
  • 25