Well, more like translator experience rather than DX, but I would like to propose that we introduce some basic markdown support in t(), to reduce the amount of HTML tags in our translatable strings, and make them shorter at the same time. I thought that it would be nice to support something that is popular in documentation writing, such as markdown style.
t() allows for @, %, and ! for variable "placeholders" within the translatable string. Although @ and ! are special in that they respectively pass the text trough check_plain() or not, % is basically the same as @, with the only difference being that it also wraps the text in <em> when rendered.
% seems to have been arbitrarily selected at a time when no other popular format was around, and is kinda "develop-y" if you ask me. With markdown being such popular in the documentation world, I would like to propose supporting the following in t():
*: works exactly the same as%, wrapping the text around<em>. We still keep%for backwards compatibility.**: works the same as%, but wraps the text around<strong>instead of<em>.***: works the same as%, but wraps the text around both<strong>and<em>.`(back-tick): works the same as%, but wraps the text around<code>instead of<em>.
So instead of this:
backdrop_set_message(t('Here is something in %italics.', array('%italics' => $some_text)), 'info');
backdrop_set_message(t('Here is something in <strong>@bold</strong>.', array('@bold' => $some_text)), 'info');
backdrop_set_message(t('Here is something in <strong><em>@bold_and_italics</em></strong>.', array('@bold_and_italics' => $some_text)), 'info');
backdrop_set_message(t('Here is some <code>@code</code>.', array('@code' => $some_code)), 'info');
...we could be doing this, which I believe is both shorter and easier for translators (especially the ones already familiar with markdown):
backdrop_set_message(t('Here is something in *@italics*.', array('@italics' => $some_text)), 'info');
backdrop_set_message(t('Here is something in **@bold**.', array('@bold' => $some_text)), 'info');
backdrop_set_message(t('Here is something in ***@bold_and_italics***.', array('@bold_and_italics' => $some_text)), 'info');
backdrop_set_message(t('Here is some `@code`.', array('@code' => $some_code)), 'info');
Advocate for this feature: @klonos
Recent comments
I have though removed the faulty parts of page and am playing with paragraphs and custom blocks, but see no way to sort paragraphs. Sorry, couldn't wait
Paypal button code gets messed-up
This is orig. code. Backdrop removes the form action and insert an end-form later (or move it down). <div> <style>.pp-VTRXBASDR9YR8{text-align:center;border:none;border-...
Paypal button code gets messed-up
Hi Egmund, can you post the original code and tell which part exactly gets removed? (To post the original code, you use the "Insert code block" button of the editor.)
Paypal button code gets messed-up