blob: 99c29d6403409228e834c2d3aca7ee7f645ab3da [file] [log] [blame]
export function normalizeContextByPath(context, currentLocale) {
if (typeof context === "string") {
return {
label: context,
path: context,
};
}
else {
const { label, path } = context;
if (typeof label === "string") {
return { label, path };
}
if (Object.prototype.hasOwnProperty.call(label, currentLocale)) {
return {
label: label[currentLocale],
path,
};
}
return {
label: path,
path,
};
}
}