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
Hi. I use the "[node:title] | [site:name]" tokens for the main image of news articles, blog posts, and similar publications. It's a quick and practical automatic ALT.
How to Improve SEO Performance in Backdrop CMS
I understand how tokens work, but not so much their practical use in image alt/text (maybe caption?) text. Could you give an example or two?
How to Improve SEO Performance in Backdrop CMS
https://backdropcms.org/project/metatag https://backdropcms.org/project/xmlsitemap https://backdropcms.org/project/imagefield_tokens These are more powerful modules, in my opinion...
How to Improve SEO Performance in Backdrop CMS