Singleton with translations
See original GitHub issueI’m trying to combine this plugin with the setup for singleton document described here. When I do this the translation tab disappears across all documents. I’m using document level translations.
Assuming the settings document needs to be translated too, how do I rewrite this to make it work?
import S from "@sanity/desk-tool/structure-builder";
export default () =>
S.list()
.title('Content')
.items([
S.listItem()
.title('Site settings')
.child(
S.document()
.schemaType('siteSettings')
.documentId('siteSettings')
),
// Add a visual divider (optional)
S.divider(),
// List out the rest of the document types, but filter out the config type
...S.documentTypeListItems()
.filter(listItem => !['siteSettings'].includes(listItem.getId()))
])
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:18 (8 by maintainers)
Top Results From Across the Web
How to use Singleton for translation in java - Stack Overflow
I want to translate a small existing java project. I should put this code in a singleton class. Now I have created a...
Read more >i18n'em all with Singleton - 50 Shades of Pink by KBDev
We can now call something like Translator.get('YES') from anywhere in our code by importing the module. Analyze logic behind the translation.
Read more >Translate Pipe - Singleton - VMware
Use the translate pipe in your HTML templates to retrieve translations from the singleton service. API. L10n pipe. Get translation by key, will ......
Read more >SINGLETON - Translation in English - bab.la
The singleton pattern is implemented by creating a class with a method that creates a new instance of the class if one does...
Read more >Charles S. Singleton - Princeton University Press
Singleton's translation of The Divine Comedy, this work provides the English-speaking reader with everything he needs to read and understand the Paradiso. This ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@jdwillemse No you can still only create the one with the fixed ID (aka singleton) because the “Create new” action is fixed to the ID with this structure. However I am aware it is slightly more cumbersome. I am talking to some guys at Sanity regarding conflicts with custom desk structure but have not been able to find a resolution yet.
This isn’t exactly what you asked for but here’s what my
deskStructure.jslooks like after setting i18n up a couple weeks ago:It doesn’t keep the whole singleton implementation but it is okay in my case. I also ended up leaving these
pageItemsungrouped (they were all previously grouped under a Pages folder).Only reason for this is I didn’t manage to make everything work while keeping the same structure. The current implementation made it easy to keep everything I had in place pretty much the same so that’s a win if you ask me.