Skip to content
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

Array of documents - Each document is repeated by the languages itself #163

Open
aleczratiu opened this issue Nov 21, 2023 · 1 comment
Open

Comments

@aleczratiu
Copy link

Hello, is there a way to avoid having all the translations for each module?
Each module is a document, and I'm using document internationalization.

The module schema

const modulesObject = {
    name: 'modules',
    type: 'array',
    title: 'Page modules',
    // Implement the page builder
    of: [
        {
            type: 'reference',
            to: [
                { title: 'hero', type: 'hero' },
                { title: 'testimonials', type: 'testimonials' },
                { title: 'features', type: 'features' },
                { title: 'cta', type: 'cta' },
                { title: 'stats', type: 'stats' },
                { title: 'socialProof', type: 'socialProof' },
                { title: 'faq', type: 'faq' },
                { title: 'related Pages', type: 'relatedPages' },
            ],
        },
    ],
};

And how it looks where I have a page builder based on array of reference documents.
screenshot_2023-11-21_at_11 04 07_pm

From my point of view, it looks very weird, I just wanna see for example the Hero module and the inside of the Hero module to be able to pick any other languages.

Are there any limitations on this topic or I'm missing something?

@LiamMartens
Copy link
Collaborator

@aleczratiu you will need a filter option for the reference type. In the filter function you can reference the current document so you could look up it's language and then only show relevant entries.

https://www.sanity.io/docs/reference-type#filter-ebd7a95f9dc6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants