угловой перевод в графане HeaderPage modify (tsx файл) - PullRequest
0 голосов
/ 26 ноября 2018

Я перевожу с помощью углового перевода в html

  {{ 'Folder' |  translate }}

Я хочу перевести .tsx файл.

оригинал

          return <h1 className="page-header__title">{title}</h1>;

Я пытаюсь

      return <h1 className="page-header__title">{title | translate}</h1>;

пс

графана index.go (ввод)

dashboardChildNavs := []*dtos.NavLink{
    {Text: "Home", Id: "home", Url: setting.AppSubUrl + "/", Icon: "gicon gicon-home", HideFromTabs: true},
    {Text: "Divider", Divider: true, Id: "divider", HideFromTabs: true},
    {Text: "Manage", Id: "manage-dashboards", Url: setting.AppSubUrl + "/dashboards", Icon: "gicon gicon-manage"},
    {Text: "Playlists", Id: "playlists", Url: setting.AppSubUrl + "/playlists", Icon: "gicon gicon-playlists"},
    {Text: "Snapshots", Id: "snapshots", Url: setting.AppSubUrl + "/dashboard/snapshots", Icon: "gicon gicon-snapshots"},
}

Я хочу получить

1018 *

до

<h1 className="page-header__title">{title | translate}</h1>

графана

public / app / core / components / PageHeader / PageHeader.tsx (вывод)

renderTitle(title: string) {
  return <h1 className="page-header__title">{title}</h1>;
}

.

const main = {"id":"dashboards","text":"Dashboards","subTitle":"Manage dashboards & folders","icon":"gicon gicon-dashboard","url":"/","children":[{"id":"home","text":"Home","icon":"gicon gicon-home","url":"/","hideFromTabs":true,"active":false},{"id":"divider","text":"Divider","divider":true,"hideFromTabs":true,"active":false},{"id":"manage-dashboards","text":"Manage","icon":"gicon gicon-manage","url":"/dashboards","active":true},{"id":"playlists","text":"Playlists","icon":"gicon gicon-playlists","url":"/playlists","active":false},{"id":"snapshots","text":"Snapshots","icon":"gicon gicon-snapshots","url":"/dashboard/snapshots","active":false}]}


return (
  <div className="page-header-canvas">
    <div className="page-container">
      <div className="page-header">
        {this.renderTitle(main)}
        {main.children && <Navigation main={main} />}
      </div>
    </div>
  </div>
);
...