Skip to content

feat: changed minimum of 2 locales to minimum of 1 #6406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 23, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,19 @@ describe('config', () => {
}).toThrowError(`'i18n.locales[1]' must NOT have more than 10 characters`);
});

it('should throw error when locales is less than 1 items', () => {
expect(() => {
validateConfig(
merge({}, validConfig, {
i18n: {
structure: 'multiple_folders',
locales: [],
},
}),
);
}).toThrowError(`'i18n.locales' must NOT have fewer than 1 items`);
});

it('should allow valid locales strings', () => {
expect(() => {
validateConfig(
Expand Down
2 changes: 1 addition & 1 deletion packages/netlify-cms-core/src/constants/configSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const i18n = {
structure: { type: 'string', enum: Object.values(I18N_STRUCTURE) },
locales: {
type: 'array',
minItems: 2,
minItems: 1,
items: localeType,
uniqueItems: true,
},
Expand Down