You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
724 B
27 lines
724 B
import React from 'react';
|
|
// @ts-ignore
|
|
import { _LocaleContainer } from './locale';
|
|
import { getIntl, getLocale } from './localeExports';
|
|
|
|
export function rootContainer(container: Element) {
|
|
return React.createElement(_LocaleContainer, null, container);
|
|
}
|
|
|
|
{{#Title}}
|
|
export function patchRoutes({ routes }) {
|
|
// loop all route for patch title field
|
|
const intl = getIntl(getLocale());
|
|
const traverseRoute = (routes) => {
|
|
routes.forEach(route => {
|
|
if (route.title) {
|
|
route.title = intl.messages[route.title] ? intl.formatMessage({ id: route.title }, {}) : route.title;
|
|
}
|
|
if (route.routes) {
|
|
traverseRoute(route.routes);
|
|
}
|
|
})
|
|
}
|
|
traverseRoute(routes);
|
|
}
|
|
{{/Title}}
|