-
Notifications
You must be signed in to change notification settings - Fork 39
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
Expand documentation for withTranslationMaintenance
#58
Comments
Update 😁 I finally realized that I missed the part of the Desk Structure documentation that says you need to import the structure from document-internationalization. I already had my desk structure built and it was much more robust than the quick examples, so I must have skipped over it? But then after missing that, I did my own totally manual implementation where I filtered the document lists manually to only list the English versions of a given document type. Given that, I'm amending my previous issue report to be:
|
Assuming this didn't change since // deskStructure.js
import S from '@sanity/desk-tool/structure-builder'
import * as Structure from 'sanity-plugin-intl-input/lib/structure'
export default () => {
const items = Structure.getFilteredDocumentTypeListItems()
const getLocalizedPosts = (type) => items.find((item) => [type].includes(item.spec.id)).getChild()
return S.list().title('Content').items([
S.listItem().title('Blog Articles').icon(RiArticleLine).child(getLocalizedPosts('blogPost')),
S.listItem().title('Blog Authors').icon(RiUserLine).child(getLocalizedPosts('blogAuthor')),
S.listItem().title('Blog Tags').icon(RiPriceTagLine).child(getLocalizedPosts('blogTag')),
S.divider(),
// NOTE: This one is the default list item imported from the package
Structure.getMaintenanceListItem(),
// NOTE: This one allows you to customize both title and icon
// items[0].title('Translation Manager').icon(RiTranslate),
])
} Please note you'll have to import Hope this helps solve your issue. EDIT: Check #67 for another example. |
The documentation for
withTranslationMaintenance
only says to set that key totrue
in thedocument-internationalization.json
config, but that alone didn't make the translation maintenance tab show for in my studio. I do have a custom desk structure but I tried a lot of things, including removing my custom desk structure entirely, to get it to show and never saw it.When I added
import * as Structure from '@sanity/document-internationalization/lib/structure';
to my desk structure andStructure.getMaintenanceListItem().serialize()
to the exportedS.list.items([])
, then it finally showed. If this is the correct way to implement it, please add that to the documentation as I only found that by literally searching all of GitHub forwithTranslationsMaintenance
😆If that shouldn't be necessary and it should work right out the box just by updating the key in the config... what might I be doing wrong, and is there something else we can put in the documentation to help future users correctly configure it from the start?
Thank you!
The text was updated successfully, but these errors were encountered: