[API Node] Sort API templates by localized display name (#3765)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Christian Byrne
2025-05-05 10:55:02 -07:00
committed by GitHub
parent 813bf11484
commit 3758a435cb
8 changed files with 194 additions and 2 deletions

View File

@@ -27,10 +27,20 @@ export const useWorkflowTemplatesStore = defineStore(
const isLoaded = ref(false)
/**
* Sort a list of templates in alphabetical order by name.
* Sort a list of templates in alphabetical order by localized display name.
*/
const sortTemplateList = (templates: TemplateInfo[]) =>
templates.sort((a, b) => a.name.localeCompare(b.name))
templates.sort((a, b) => {
const aName = st(
`templateWorkflows.name.${normalizeI18nKey(a.name)}`,
a.title ?? a.name
)
const bName = st(
`templateWorkflows.name.${normalizeI18nKey(b.name)}`,
b.name
)
return aName.localeCompare(bName)
})
/**
* Sort any template categories (grouped templates) that should be sorted.