@@ -92,17 +92,24 @@ function setI18nField<T extends BaseField = UnknownField>(field: T) {
92
92
93
93
function getI18nDefaults (
94
94
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 > ,
96
101
) : I18nInfo {
97
102
if ( typeof collectionOrFileI18n === 'boolean' ) {
98
- return { default_locale, locales, structure } ;
103
+ return { default_locale, locales, structure, enforce_required_non_default } ;
99
104
} else {
100
105
const mergedI18n : I18nInfo = deepmerge (
101
- { default_locale, locales, structure } ,
106
+ { default_locale, locales, structure, enforce_required_non_default } ,
102
107
collectionOrFileI18n ,
103
108
) ;
104
109
mergedI18n . locales = collectionOrFileI18n . locales ?? locales ;
105
110
mergedI18n . default_locale = collectionOrFileI18n . default_locale || locales ?. [ 0 ] ;
111
+ mergedI18n . enforce_required_non_default =
112
+ collectionOrFileI18n . enforce_required_non_default || true ;
106
113
throwOnMissingDefaultLocale ( mergedI18n ) ;
107
114
return mergedI18n ;
108
115
}
@@ -202,6 +209,7 @@ function applyCollectionFileDefaults(
202
209
locales : collectionI18n . locales ,
203
210
default_locale : collectionI18n . default_locale ,
204
211
structure : collectionI18n . structure ,
212
+ enforce_required_non_default : collectionI18n . enforce_required_non_default ,
205
213
} ) ;
206
214
file . i18n = fileI18n ;
207
215
} else {
@@ -315,6 +323,7 @@ export function applyDefaults<EF extends BaseField = UnknownField>(
315
323
316
324
if ( i18n ) {
317
325
i18n . default_locale = i18n . default_locale ?? i18n . locales [ 0 ] ;
326
+ i18n . enforce_required_non_default = i18n . enforce_required_non_default ?? true ;
318
327
}
319
328
320
329
throwOnMissingDefaultLocale ( i18n ) ;
0 commit comments