diff --git a/packages/decap-cms-core/src/components/Editor/EditorInterface.js b/packages/decap-cms-core/src/components/Editor/EditorInterface.js index 912dbe63e581..d3004cfe8b4b 100644 --- a/packages/decap-cms-core/src/components/Editor/EditorInterface.js +++ b/packages/decap-cms-core/src/components/Editor/EditorInterface.js @@ -238,8 +238,8 @@ class EditorInterface extends Component { const previewEnabled = isPreviewEnabled(collection, entry); - const collectionI18nEnabled = hasI18n(collection); const { locales, defaultLocale } = getI18nInfo(this.props.collection); + const collectionI18nEnabled = hasI18n(collection) && locales.length > 1; const editorProps = { collection, entry, diff --git a/packages/decap-cms-core/src/constants/__tests__/configSchema.spec.js b/packages/decap-cms-core/src/constants/__tests__/configSchema.spec.js index fffe785609f4..d0cae4d34e03 100644 --- a/packages/decap-cms-core/src/constants/__tests__/configSchema.spec.js +++ b/packages/decap-cms-core/src/constants/__tests__/configSchema.spec.js @@ -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( diff --git a/packages/decap-cms-core/src/constants/configSchema.js b/packages/decap-cms-core/src/constants/configSchema.js index 31e3711f8745..24125c86ffd1 100644 --- a/packages/decap-cms-core/src/constants/configSchema.js +++ b/packages/decap-cms-core/src/constants/configSchema.js @@ -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, },