We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3066a4c commit 95a7052Copy full SHA for 95a7052
__test__/locale.spec.ts
@@ -0,0 +1,28 @@
1
+import { describe, it, expect } from 'vitest'
2
+import { resolve } from 'node:path'
3
+import { readdirSync } from 'node:fs'
4
+import en from '../locales/en-US.json'
5
+
6
+function getKeys(obj: any, path = '', result: string[] = []) {
7
+ for (let key in obj) {
8
+ if (typeof obj[key] === 'object') {
9
+ getKeys(obj[key], path ? `${path}.${key}` : key, result);
10
+ } else {
11
+ result.push(path ? `${path}.${key}` : key);
12
+ }
13
14
+ return result;
15
+}
16
17
+const localesOtherThanEnglish = readdirSync(resolve(__dirname, '../locales')).filter((file) => {
18
+ return file.endsWith('.json') && !file.startsWith('en-US')
19
+})
20
+const defaultKeys = getKeys(en);
21
22
+describe("locale files should include all keys", () => {
23
+ localesOtherThanEnglish.forEach((locale) => {
24
+ it(`for ${locale}`, () => {
25
+ expect(getKeys(require(`../locales/${locale}`))).toEqual(defaultKeys)
26
+ })
27
28
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments