fix(cli): update locale name validation when installing locales

This commit is contained in:
melvinchia3636
2026-01-30 06:30:26 +08:00
parent 9dabad04c7
commit 58882ecf3a

View File

@@ -14,7 +14,7 @@ export async function installLocaleHandler(langCode: string): Promise<void> {
'locale'
)
if (!/^@lifeforge\/lang-[a-z]{2}(-[A-Z]{2})?$/i.test(fullName)) {
if (!/^@lifeforge\/.*?-lang-[a-z]{2}(-[A-Z]{2})?$/i.test(fullName)) {
logger.error(
`Invalid locale name: ${chalk.blue(langCode)}. Locale names should follow the format "xx" or "xx-XX", where "xx" is a two-letter language code and "XX" is a two-letter country code.`
)