Page MenuHomePhabricator

Cannot translate pht strings with unicode characters in it.
Closed, ResolvedPublic

Description

For this line:

src/applications/audit/constants/PhabricatorAuditActionConstants.php:      self::ACCEPT       => pht("Accept Commit \xE2\x9C\x94"),

I tried first:

"Accept Commit \xE2\x9C\x94": "添加审核人\xE2\x9C\x94",

Phabricator throws error:

The given value must be valid JSON. This means, among other things, that you must wrap strings in double-quotes.

Then I tried:

"Accept Commit \\xE2\\x9C\\x94": "添加审核人\\xE2\\x9C\\x94",

It won't cause errors but also doesn't take effect. So now I am stuck with this half-done dropdown:

pasted_file (159×193 px, 6 KB)

How do I properly escape the \ character?

Event Timeline

epriestley claimed this task.
epriestley added a subscriber: epriestley.
  • JSON does not use "\x" escapes. See https://json.org/
  • The untranslated text is "Accept Revision ✔", I'm not sure why yours says "Accept Commit ✔".
  • This config value:

Screen Shot 2016-01-19 at 7.16.35 AM.png (303×945 px, 22 KB)

  • ...produces this result:

Screen Shot 2016-01-19 at 7.15.57 AM.png (292×358 px, 29 KB)

Oh, you're translating Audit. That's why it says "Accept Commit". I thought you were translating Differential, sorry. Everything else should work in Audit.

Thanks. I figured out that the string in php is utf-8 and the one in json must be unicode. I must convert manually myself. It is now working correctly.