feat: refs #5186 use global locales
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-03-14 15:16:50 +01:00
parent f39595087a
commit dd91449818
2 changed files with 8 additions and 4 deletions

View File

@ -41,8 +41,9 @@ function getBreadcrumb(param) {
breadcrumb.title = useCamelCase(param.meta.title); breadcrumb.title = useCamelCase(param.meta.title);
} }
breadcrumb.locale = te(`${breadcrumb.root}.pageTitles.${breadcrumb.title}`) const moduleLocale = `${breadcrumb.root}.pageTitles.${breadcrumb.title}`;
? t(`${breadcrumb.root}.pageTitles.${breadcrumb.title}`) breadcrumb.locale = te(moduleLocale)
? t(moduleLocale)
: t(`globals.pageTitles.${breadcrumb.title}`); : t(`globals.pageTitles.${breadcrumb.title}`);
return breadcrumb; return breadcrumb;

View File

@ -15,7 +15,7 @@ import { toLowerCamel } from 'src/filters';
const state = useState(); const state = useState();
const session = useSession(); const session = useSession();
const { t } = i18n.global; const { t, te } = i18n.global;
const createHistory = process.env.SERVER const createHistory = process.env.SERVER
? createMemoryHistory ? createMemoryHistory
@ -90,7 +90,10 @@ export default route(function (/* { store, ssrContext } */) {
if (childPageTitle && matches.length > 2) { if (childPageTitle && matches.length > 2) {
if (title != '') title += ': '; if (title != '') title += ': ';
const pageTitle = t(`${moduleName}.pageTitles.${childPageTitle}`); const moduleLocale = `${moduleName}.pageTitles.${childPageTitle}`;
const pageTitle = te(moduleLocale)
? t(moduleLocale)
: t(`globals.pageTitles.${childPageTitle}`);
const idParam = to.params && to.params.id; const idParam = to.params && to.params.id;
const idPageTitle = `${idParam} - ${pageTitle}`; const idPageTitle = `${idParam} - ${pageTitle}`;
const builtTitle = idParam ? idPageTitle : pageTitle; const builtTitle = idParam ? idPageTitle : pageTitle;