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

Simple(?) use case help #169

Open
ottob opened this issue Dec 21, 2023 · 0 comments
Open

Simple(?) use case help #169

ottob opened this issue Dec 21, 2023 · 0 comments

Comments

@ottob
Copy link

ottob commented Dec 21, 2023

Is your feature request related to a problem? Please describe.
First of all thanks for a very nice tool! But some more use case examples would be very helpful.

Let's say I want to add a book to Sanity and translate it using document-internationalization. A book has many chapters and chapters have many pages.

My first approach was to use document-level translations for the book, chapters and pages. So I added a Swedish book that have references to chapters:

    defineField({
      name: 'chapters',
      title: 'Chapters',
      type: 'array',
      of: [{type: 'reference', to: {type: 'chapter'}}]
    }),
    // which has references to pages:
    defineField({
      name: 'pages',
      title: 'Pages',
      type: 'array',
      of: [{type: 'reference', to: {type: 'page'}}]}),

Then I added the first Swedish chapter as a reference to the Swedish book. And repeated this process for the Swedish pages. This works quite well. It's nice being able to for example visually reorder chapters using drag and drop.
But when I want to add a Norwegian translation of the book I have to redo the entire process, but backwards. Create new Norwegian translation copies of the pages. New copies of all the chapters, and add the Norwegian pages to the Norwegian chapters etc. This does not feel like a sane approach 😅. Consider that we might have 100 chapters and a factor more pages.

I then thought it might be better to use field level translations for the book and chapters. Since they only change very little between translations. But even if I have a single field level translated chapter, I need to add pages to it. And I do not want to reference a specific translation of the page.

If I added a reference to the field level translated chapter to the page (reverse the reference, page -> chapter instead of chapter -> page), it could possibly work. But then I would lose the ability to reorder pages in chapter visually. I could add a sort order number, but that would not be as nice.

Please help me, it feels like I'm missing something obvious here. Happy holidays! 🎄

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

1 participant