fix(editor): Fix unique names for node duplication (#6134)
* 🐛 Fix unique names for node duplication * 🐛 Fix i18n references
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
import { i18n } from '@/plugins/i18n';
|
||||
import { useRootStore } from '@/stores/n8nRootStore';
|
||||
|
||||
export function useI18n() {
|
||||
return i18n;
|
||||
const isEnglishLocale = useRootStore().defaultLocale === 'en';
|
||||
|
||||
function localizeNodeName(nodeName: string, type: string) {
|
||||
if (isEnglishLocale) return nodeName;
|
||||
|
||||
const nodeTypeName = i18n.shortNodeType(type);
|
||||
|
||||
return i18n.headerText({
|
||||
key: `headers.${nodeTypeName}.displayName`,
|
||||
fallback: nodeName,
|
||||
});
|
||||
}
|
||||
|
||||
return { i18n, localizeNodeName };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user