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'm not sure I'm getting it. It is working as intended now. Let me post you some images. Thanks!
have a view show contents in table and leaflet format simultaneously.
https://github.com/backdrop/backdrop-issues/issues/7018 Feel free to edit as you see fit. KR Mike
MySQL Database 4-byte UTF-8 support
Thanks. Would you please file an issue at https://github.com/backdrop/backdrop-issues/issues? The idea there is to say that a site that uses a DB prefix defined in the simplified database...
MySQL Database 4-byte UTF-8 support