1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2024-12-23 15:37:59 +01:00
Whalebird-desktop-client-ma.../spec/config/i18n.spec.ts
2022-11-04 20:56:23 +09:00

44 lines
867 B
TypeScript

import * as path from 'path'
import fs from 'fs'
import keys from 'all-object-keys'
const locales = [
'de',
'fr',
'gd',
'it',
'ja',
'ko',
'pl',
'is',
'it',
'zh_cn',
'zh_tw',
'cs',
'es_es',
'no',
'pt_pt',
'ru',
'si',
'sv_se',
'tzm',
'fa'
]
describe('i18n', () => {
describe('should not define duplicate keys', () => {
locales.forEach(locale => {
it(`${locale} translation`, () => {
const targetJson = JSON.parse(
fs.readFileSync(path.resolve(__dirname, `../../src/config/locales/${locale}/translation.json`), 'utf8')
)
const allKeys = keys(targetJson)
const duplicates: Array<string> = allKeys.filter(
(x: string, _: number, self: Array<string>) => self.indexOf(x) !== self.lastIndexOf(x)
)
expect(duplicates).toEqual([])
})
})
})
})