You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Content that can be translated to other languages may sometimes require changes to its structure. Total %d for example may get translated in German to %d Gesamt.
There may also be entire sentences which get translated. If they're translated to a language such as Arabic the sentence may reversed as textual content in Arabic is written from right to left (RTL).
To make this possible, source code must mark the entire content in a single message as localizable. e.g. t('Total %d'). String concatenation is not possible.
In case a developer wants to enrich parts of the content with HTML, this is currently not possible in such a case. Say I'd want to put Total in a span to style it differently, the result would look like this: (Example taken from https://github.com/Icinga/icingadb-web/pull/94/files)
<span class="meta">Total</span> %d
Though, this would require rendering the HTML instantly and allow the translator to change the markup. Both are undesirable side-effects.
Describe the solution you'd like
There is already the possibility to format content using the class FormattedString. Why not extend it so that it supports a simple form of templating. This could look like this:
Is your feature request related to a problem? Please describe.
Content that can be translated to other languages may sometimes require changes to its structure.
Total %d
for example may get translated in German to%d Gesamt
.There may also be entire sentences which get translated. If they're translated to a language such as Arabic the sentence may reversed as textual content in Arabic is written from right to left (RTL).
To make this possible, source code must mark the entire content in a single message as localizable. e.g.
t('Total %d')
. String concatenation is not possible.In case a developer wants to enrich parts of the content with HTML, this is currently not possible in such a case. Say I'd want to put
Total
in a span to style it differently, the result would look like this: (Example taken from https://github.com/Icinga/icingadb-web/pull/94/files)<span class="meta">Total</span> %d
Though, this would require rendering the HTML instantly and allow the translator to change the markup. Both are undesirable side-effects.
Describe the solution you'd like
There is already the possibility to format content using the class
FormattedString
. Why not extend it so that it supports a simple form of templating. This could look like this:{{#total}}Total{{/total}} %d
Given the following code:
The result could be:
<span>Total</span> 1234
and in German:
1234 <span>Gesamt</span>
The text was updated successfully, but these errors were encountered: