diff --git a/.changeset/quick-flies-provide.md b/.changeset/quick-flies-provide.md new file mode 100644 index 0000000000..87a9eb5048 --- /dev/null +++ b/.changeset/quick-flies-provide.md @@ -0,0 +1,5 @@ +--- +"@medusajs/dashboard": patch +--- + +feat(translation): Order translastable entities ordered alphabetically diff --git a/packages/admin/dashboard/src/routes/translations/translation-list/translation-list.tsx b/packages/admin/dashboard/src/routes/translations/translation-list/translation-list.tsx index fd10aff7cc..25f4df9edf 100644 --- a/packages/admin/dashboard/src/routes/translations/translation-list/translation-list.tsx +++ b/packages/admin/dashboard/src/routes/translations/translation-list/translation-list.tsx @@ -60,28 +60,32 @@ export const TranslationList = () => { return [] } - return Object.entries(translatable_fields) - .filter( - ([entity]) => - !["product_option", "product_option_value"].includes(entity) - ) - .map(([entity, fields]) => { - const entityStatistics = statistics?.[entity] ?? { - translated: 0, - expected: 0, - } + return ( + Object.entries(translatable_fields) + .filter( + ([entity]) => + !["product_option", "product_option_value"].includes(entity) + ) + .map(([entity, fields]) => { + const entityStatistics = statistics?.[entity] ?? { + translated: 0, + expected: 0, + } - return { - label: entity - .split("_") - .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(" "), - reference: entity, - translatableFields: fields, - translatedCount: entityStatistics.translated, - totalCount: entityStatistics.expected, - } - }) + return { + label: entity + .split("_") + .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) + .join(" "), + reference: entity, + translatableFields: fields, + translatedCount: entityStatistics.translated, + totalCount: entityStatistics.expected, + } + }) + // sort by label alphabetically + .sort((a, b) => a.label.localeCompare(b.label)) + ) }, [translatable_fields, statistics]) const isReady =