At the moment, translations are supposed to be plain text. However, in practice we have frequently the need to put a link in a translation or highlight some part of it as bold text. The documented best practice is to inject XWiki syntax or HTML as parameters into the message, i.e., to have a placeholder where the syntax would be. However, this means we need to interpret the result as XWiki syntax or HTML and this can have unintended side effects like XWIKI-19149. There are workarounds we are currently using but this is usually quite ugly.
I propose introducing support for a small subset of XWiki syntax in translations. My proposal would be to support the following features in addition to the existing support for Message Format like placeholders and choices:
- Links, but without support for formatting in link labels (link labels would be parsed as plain text and therefore not need double escaping). Possibly, support for parameters could also be limited to those directly relevant for links like
queryStringand not generic parameters.
- Text formatting, in particular bold and italics, possibly also underline, striked out, monospace, superscript, subscript.
- Escaping using
The main question is where to support this syntax. There are two options that could also be combined:
- In the translation message itself. This means translators need to understand the syntax but compared to placeholders translators know what the syntax is about (vs. having an opaque placeholder).
- In parameters as currently documented. This means translators only need to know about placeholders but they might not understand what they mean and might, e.g., unknowingly reverse link start and end syntax.
We have existing translations for both variants, so unless we implement both we need to adapt existing translations.
As we probably need to develop a new parser for translations, anyways, we could also support other features. In particular I want to propose the following feature as I believe it could be useful:
- Named placeholders. Make it possible to use names instead of numbers for placeholders, for example,
I have also created a design page with some more details about the proposed changes.
I’m open for input and I would in particular also appreciate input by translators like @Simpel, @shirahara, @xrichard or @safronovyua. I’m mentioning you because you’ve been active in forum posts related to translations, I’m of course also looking for input from all other translators. Also, if you have different ideas how to improve translations/translation syntax, please let us know.
I also suggest organizing a meeting to discuss these options to hopefully already reach some consensus. Please indicate in this poll when you would be available. I’ll close the poll tomorrow, January 11th at 14:00 CET and announce the meeting the time here. You can of course also still join the meeting if you haven’t filled the poll.
Independently of the meeting, please also express your opinions here, in particular if you (possibly) won’t participate in the meeting.