Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

319 B
Raw Blame
export type MenuTranslator = (message: string, values?: Record<string, string>) => string;

export function translateEnglish(message: string, values?: Record<string, string>): string {
  if (values === undefined) return message;
  return message.replace(/\{(\w+)\}/g, (whole, name: string) => values[name] ?? whole);
}