@@ -92,17 +92,24 @@ function setI18nField<T extends BaseField = UnknownField>(field: T) {
9292
9393function getI18nDefaults (
9494 collectionOrFileI18n : boolean | Partial < I18nInfo > ,
95- { default_locale, locales = [ 'en' ] , structure = I18N_STRUCTURE_SINGLE_FILE } : Partial < I18nInfo > ,
95+ {
96+ default_locale,
97+ locales = [ 'en' ] ,
98+ structure = I18N_STRUCTURE_SINGLE_FILE ,
99+ enforce_required_non_default = true ,
100+ } : Partial < I18nInfo > ,
96101) : I18nInfo {
97102 if ( typeof collectionOrFileI18n === 'boolean' ) {
98- return { default_locale, locales, structure } ;
103+ return { default_locale, locales, structure, enforce_required_non_default } ;
99104 } else {
100105 const mergedI18n : I18nInfo = deepmerge (
101- { default_locale, locales, structure } ,
106+ { default_locale, locales, structure, enforce_required_non_default } ,
102107 collectionOrFileI18n ,
103108 ) ;
104109 mergedI18n . locales = collectionOrFileI18n . locales ?? locales ;
105110 mergedI18n . default_locale = collectionOrFileI18n . default_locale || locales ?. [ 0 ] ;
111+ mergedI18n . enforce_required_non_default =
112+ collectionOrFileI18n . enforce_required_non_default || true ;
106113 throwOnMissingDefaultLocale ( mergedI18n ) ;
107114 return mergedI18n ;
108115 }
@@ -202,6 +209,7 @@ function applyCollectionFileDefaults(
202209 locales : collectionI18n . locales ,
203210 default_locale : collectionI18n . default_locale ,
204211 structure : collectionI18n . structure ,
212+ enforce_required_non_default : collectionI18n . enforce_required_non_default ,
205213 } ) ;
206214 file . i18n = fileI18n ;
207215 } else {
@@ -315,6 +323,7 @@ export function applyDefaults<EF extends BaseField = UnknownField>(
315323
316324 if ( i18n ) {
317325 i18n . default_locale = i18n . default_locale ?? i18n . locales [ 0 ] ;
326+ i18n . enforce_required_non_default = i18n . enforce_required_non_default ?? true ;
318327 }
319328
320329 throwOnMissingDefaultLocale ( i18n ) ;
0 commit comments