Skip to content

Commit

Permalink
Merge branch 'develop' into feat/OB-9802
Browse files Browse the repository at this point in the history
  • Loading branch information
web-mi authored Feb 28, 2024
2 parents 50d3eba + 97df5dd commit 1f940e0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,17 @@ export const init = async (
)
];

const mergeAndFlattenNamespace = (namespace) => {
if (Array.isArray(namespace)) {
return _.merge({}, ...namespace.map((ns) => flatten(ns)));
}
return flatten(namespace);
};
const flattenBaseResource = (resource) => {
if (!resource) return {};
return Object.keys(resource).reduce((acc, lng) => {
acc[lng] = Object.keys(resource[lng]).reduce((acc, ns) => {
acc[ns] = flatten(resource[lng][ns]);
acc[ns] = mergeAndFlattenNamespace(resource[lng][ns]);
return acc;
}, {});
return acc;
Expand Down

0 comments on commit 1f940e0

Please sign in to comment.