MCPcopy
hub / github.com/Done-0/fuck-u-code / t

Function t

src/i18n/index.ts:41–55  ·  view source on GitHub ↗
(key: string, params?: Record<string, string | number>)

Source from the content-addressed store, hash-verified

39 * @param params - Replacement parameters
40 */
41export function t(key: string, params?: Record<string, string | number>): string {
42 const translation = translations[currentLocale][key as TranslationKey];
43 if (!translation) {
44 return key;
45 }
46
47 if (!params) {
48 return translation;
49 }
50
51 return translation.replace(/\{(\w+)\}/g, (_, paramKey: string) => {
52 const value = params[paramKey];
53 return value !== undefined ? String(value) : `{${paramKey}}`;
54 });
55}

Callers 15

index.tsFile · 0.85
analyzeFilesConcurrentlyFunction · 0.85
analyzeFileFunction · 0.85
calculateMethod · 0.85
calculateMethod · 0.85
calculateMethod · 0.85
calculateMethod · 0.85
calculateMethod · 0.85
calculateMethod · 0.85
calculateSimplifiedMethod · 0.85
calculateMethod · 0.85
calculateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected