diff --git a/lib/functions.ts b/lib/functions.ts index e2c1a59..364c663 100644 --- a/lib/functions.ts +++ b/lib/functions.ts @@ -34,9 +34,10 @@ export const getPath = (...paths: string[]) => resolve(rootPath, config.localesP * @returns array of namespaces */ export const getNamespaces = () => - config.useSingleFile + (config.useSingleFile ? Object.keys(JSON.parse(readFileSync(getPath(`${config.defaultLocale}.json`), 'utf-8'))) : readdirSync(getPath(config.defaultLocale)).filter(file => extname(file) == '.json') + ).sort() /** * gets content of a file as json