Skip to content

Commit ec91736

Browse files
committed
add support for reusable locale
1 parent a2f2e90 commit ec91736

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: __test__/locale.spec.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ const locales = readdirSync(resolve(__dirname, '../locales')).filter((file) => {
99
})
1010

1111
describe('should match name regex', () => {
12+
/**
13+
*
14+
* both can match normal locale or reusable locale
15+
*
16+
* @example normal locale: en-US
17+
* @example reusable locale: zh-Hant
18+
*/
19+
const regex = /^[a-zA-Z]{2}(-[a-zA-Z]{2})*.json$|^[a-zA-Z]{2}(-[a-zA-z]{4})*.json$/
1220
locales.forEach((locale) => {
13-
it(`for ${locale}`, () => {
14-
expect(locale).toMatch(/^[a-zA-Z]{2}(-[a-zA-Z]{2})*.json$/)
15-
})
21+
it(`for ${locale}`, () => {
22+
expect(locale).toMatch(regex)
23+
})
1624
})
1725
})
1826

0 commit comments

Comments
 (0)