### What? Allows document to successfully be saved when `fallback to default locale` checked without throwing an error. ### Why? The `fallback to default locale` checkbox allows users to successfully save a document in the admin panel while using fallback data for required fields, this has been broken since the release of `v3`. Without the checkbox override, the user would be prevented from saving the document in the UI because the field is required and will throw an error. The logic of using fallback data is not affected by this checkbox - it is purely to allow saving the document in the UI. ### How? The `fallback` checkbox used to have an `onChange` function that replaces the field value with null, allowing it to get processed through the standard localization logic and get replaced by fallback data. However, this `onChange` was removed at some point and the field was passing the actual checkbox value `true`/`false` which then breaks the form and prevent it from saving. This fallback checkbox is only displayed when `fallback: true` is set in the localization config. This PR also updated the checkbox to only be displayed when `required: true` - when it's the field is not `required` this checkbox serves no purpose. Also adds tests to `localization/e2e`. Fixes #11245 --------- Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
export const englishTitle = 'english'
|
|
export const spanishTitle = 'spanish'
|
|
export const relationEnglishTitle = 'english-relation'
|
|
export const relationSpanishTitle = 'spanish-relation'
|
|
export const relationEnglishTitle2 = `${relationEnglishTitle}2`
|
|
export const relationSpanishTitle2 = `${relationSpanishTitle}2`
|
|
|
|
export const defaultLocale = 'en'
|
|
export const spanishLocale = 'es'
|
|
export const portugueseLocale = 'pt'
|
|
export const hungarianLocale = 'hu'
|
|
|
|
// Slugs
|
|
export const localizedPostsSlug = 'localized-posts'
|
|
export const localizedDateFieldsSlug = 'localized-date-fields'
|
|
export const withLocalizedRelSlug = 'with-localized-relationship'
|
|
export const relationshipLocalizedSlug = 'relationship-localized'
|
|
export const withRequiredLocalizedFields = 'localized-required'
|
|
export const localizedSortSlug = 'localized-sort'
|
|
|
|
export const localizedDraftsSlug = 'localized-drafts'
|
|
export const usersSlug = 'users'
|
|
export const blocksWithLocalizedSameName = 'blocks-same-name'
|
|
export const cannotCreateDefaultLocale = 'cannot-create-default-locale'
|
|
export const arrayWithFallbackCollectionSlug = 'array-with-fallback-fields'
|