Last modified: 2014-11-01 00:52:38 UTC
wfMessage( 'i<dont>exist' ) has a two possible outputs depending on the format utilized to output the content, either: plain: <i<dont>exist> text/escaped/parse: <i<dont>exist> Note that i'm not encouraging special characters in i18n keys, merely showing what the current implementation does. The method documentation for Message::text() states that it is unescaped message text. Documentation for Message::plain() states that it is unescaped untransformed text. Based on the documentation my inference is that text() and plain() should have the same output, with {{FOO}} messages transformed only in the text method. One option for escaping is to escape as close to the output as possible. In an API response consumed by client-side javascript the strings within the JSON should be plain text. This plain text is then escaped for output in the templating layer of the client side javascript. Using this setup mistyping an i18n key looks like you have not only bad i18n key but also a double-encoding issue. Upon further investigation the double-encoding only happens with the non-existent key. I'm proposing the output should be: plain/text: <i<dont>exist> escaped/parse: <i<dont>exist>
Change 137458 had a related patch set uploaded by EBernhardson: Correct output of wfMessage( 'non-existent-msg' )->text() https://gerrit.wikimedia.org/r/137458
*** Bug 62047 has been marked as a duplicate of this bug. ***
Change 137458 merged by jenkins-bot: Message: Correct output of wfMessage( 'non-existent-msg' )->text() https://gerrit.wikimedia.org/r/137458