File size: 232 Bytes
cd6f98e
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import {i18n} from "next-i18next";

type Namespace =
  'errors' | 'drawer'


export const translate = (key: string, ns: Namespace | undefined) => {
  const opts = !!ns ? { ns } : undefined
  return i18n?.t(key, key, opts) ?? key;
}