MCPcopy
hub / github.com/youzan/vant / useTranslate

Function useTranslate

packages/vant/docs/site/use-translate.ts:94–109  ·  view source on GitHub ↗
(i18n: Record<string, any>)

Source from the content-addressed store, hash-verified

92let demoUid = 0;
93
94export function useTranslate(i18n: Record<string, any>) {
95 const demoName = `demo-i18n-${demoUid++}`;
96
97 if (i18n) {
98 const locales: Record<string, any> = {};
99 const camelizedName = camelize(demoName);
100
101 Object.keys(i18n).forEach((key) => {
102 locales[key] = { [camelizedName]: i18n[key] };
103 });
104
105 Locale.add(locales);
106 }
107
108 return createTranslate(demoName);
109}

Callers

nothing calls this directly

Calls 3

camelizeFunction · 0.90
createTranslateFunction · 0.90
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…