Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ec91736

Browse files
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

‎__test__/locale.spec.ts

Lines changed: 11 additions & 3 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /