Initial commit

This commit is contained in:
AI
2026-05-03 07:26:12 +00:00
commit 776d374b59
57 changed files with 15968 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
import { describe, expect, it } from 'vitest'
import en from '../i18n/locales/en.json'
import sk from '../i18n/locales/sk.json'
type JsonValue = string | number | boolean | null | JsonObject | JsonValue[]
type JsonObject = Record<string, JsonValue>
function collectLeafPaths(value: JsonValue, prefix = ''): string[] {
if (Array.isArray(value)) {
return value.flatMap((item, index) => collectLeafPaths(item, `${prefix}[${index}]`))
}
if (value !== null && typeof value === 'object') {
return Object.entries(value as JsonObject).flatMap(([key, nestedValue]) =>
collectLeafPaths(nestedValue, prefix ? `${prefix}.${key}` : key)
)
}
return [prefix]
}
describe('i18n locale files', () => {
it('keep the same translation key structure in slovak and english', () => {
const skPaths = collectLeafPaths(sk as JsonObject).sort()
const enPaths = collectLeafPaths(en as JsonObject).sort()
expect(skPaths).toEqual(enPaths)
})
})