mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
Automatically support basic HTML tags in translations
This allows front-end translations to use basic (attributeless) HTML tags freely, without the need for the translator call to supply a matching vdom element. Translations can thus make use of styling (<em>, <code>, etc.) as they see fit. The translator call can still optionally supply a vdom element to substitute in more complex tags where necessary (e.g. hyperlinks). /cc @dcsjapan
This commit is contained in:
parent
829f0e0275
commit
edbc1164d1
4
framework/core/js/admin/dist/app.js
vendored
4
framework/core/js/admin/dist/app.js
vendored
|
@ -18368,7 +18368,7 @@ System.register('flarum/components/EditGroupModal', ['flarum/components/Modal',
|
||||||
m(
|
m(
|
||||||
'div',
|
'div',
|
||||||
{ className: 'helpText' },
|
{ className: 'helpText' },
|
||||||
app.translator.trans('core.admin.edit_group.icon_text', { a: m('a', { href: 'http://fortawesome.github.io/Font-Awesome/icons/', tabindex: '-1' }) }, { em: m('em', null) }, { code: m('code', null) })
|
app.translator.trans('core.admin.edit_group.icon_text', { a: m('a', { href: 'http://fortawesome.github.io/Font-Awesome/icons/', tabindex: '-1' }) })
|
||||||
),
|
),
|
||||||
m('input', { className: 'FormControl', placeholder: 'bolt', value: this.icon(), oninput: m.withAttr('value', this.icon) })
|
m('input', { className: 'FormControl', placeholder: 'bolt', value: this.icon(), oninput: m.withAttr('value', this.icon) })
|
||||||
),
|
),
|
||||||
|
@ -22146,7 +22146,7 @@ System.register('flarum/Translator', ['flarum/models/User', 'flarum/helpers/user
|
||||||
if (match[2]) {
|
if (match[2]) {
|
||||||
open.shift();
|
open.shift();
|
||||||
} else {
|
} else {
|
||||||
var tag = input[match[3]] || [];
|
var tag = input[match[3]] || { tag: match[3], children: [] };
|
||||||
open[0].push(tag);
|
open[0].push(tag);
|
||||||
open.unshift(tag.children || tag);
|
open.unshift(tag.children || tag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ export default class EditGroupModal extends Modal {
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
<label>{app.translator.trans('core.admin.edit_group.icon_label')}</label>
|
<label>{app.translator.trans('core.admin.edit_group.icon_label')}</label>
|
||||||
<div className="helpText">
|
<div className="helpText">
|
||||||
{app.translator.trans('core.admin.edit_group.icon_text', {a: <a href="http://fortawesome.github.io/Font-Awesome/icons/" tabindex="-1"/>}, {em: <em/>}, {code: <code/>})}
|
{app.translator.trans('core.admin.edit_group.icon_text', {a: <a href="http://fortawesome.github.io/Font-Awesome/icons/" tabindex="-1"/>})}
|
||||||
</div>
|
</div>
|
||||||
<input className="FormControl" placeholder="bolt" value={this.icon()} oninput={m.withAttr('value', this.icon)}/>
|
<input className="FormControl" placeholder="bolt" value={this.icon()} oninput={m.withAttr('value', this.icon)}/>
|
||||||
</div>
|
</div>
|
||||||
|
|
2
framework/core/js/forum/dist/app.js
vendored
2
framework/core/js/forum/dist/app.js
vendored
|
@ -29718,7 +29718,7 @@ System.register('flarum/Translator', ['flarum/models/User', 'flarum/helpers/user
|
||||||
if (match[2]) {
|
if (match[2]) {
|
||||||
open.shift();
|
open.shift();
|
||||||
} else {
|
} else {
|
||||||
var tag = input[match[3]] || [];
|
var tag = input[match[3]] || { tag: match[3], children: [] };
|
||||||
open[0].push(tag);
|
open[0].push(tag);
|
||||||
open.unshift(tag.children || tag);
|
open.unshift(tag.children || tag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ export default class Translator {
|
||||||
if (match[2]) {
|
if (match[2]) {
|
||||||
open.shift();
|
open.shift();
|
||||||
} else {
|
} else {
|
||||||
let tag = input[match[3]] || [];
|
let tag = input[match[3]] || {tag: match[3], children: []};
|
||||||
open[0].push(tag);
|
open[0].push(tag);
|
||||||
open.unshift(tag.children || tag);
|
open.unshift(tag.children || tag);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user