```  gettext('My magic ain\'t working string')  ```  Not big deal — now that works.  But then comes into play `xgettext`. During extraction `xgettext` will get string as it is — with  escaped single quote.
For the record, this is not the case. xgettext recognizes character escapes and canonicalize strings before writing. So the output shouldn't contain escaped single quote:
$ cat a.js gettext('My magic ain\'t working string')
$ xgettext -L _javascript_ --no-location --omit-header -o - a.js msgid "My magic ain't working string" msgstr ""