| | |
| | | } |
| | | const formatMenuTitle = (title) => { |
| | | if (title) { |
| | | if (i18n.global.te(title)) { |
| | | return $t(title) |
| | | } |
| | | if (title.startsWith('menus.') || title.startsWith('menu.')) { |
| | | if (i18n.global.te(title)) { |
| | | return $t(title) |
| | | } else { |
| | | const fallbackTitle = |
| | | title.startsWith('menus.') && title.split('.').pop() |
| | | ? `menu.${title.split('.').pop()}` |
| | | : '' |
| | | if (fallbackTitle && i18n.global.te(fallbackTitle)) { |
| | | return $t(fallbackTitle) |
| | | } |
| | | return title.split('.').pop() || title |
| | | const leaf = title.startsWith('menus.') ? title.slice('menus.'.length) : '' |
| | | const aliasTitle = leaf ? `menu.${leaf}` : '' |
| | | if (aliasTitle && i18n.global.te(aliasTitle)) { |
| | | return $t(aliasTitle) |
| | | } |
| | | return '' |
| | | } |
| | | return title |
| | | } |