-
Notifications
You must be signed in to change notification settings - Fork 8
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
Clean up languages/datasets for web and sanity #710
Comments
Since we do not yet share code between |
With the new approach all the languages/dataset setup is done throught the file The base language is still being defined accordingly to the order of the language array (check comment on line 8). I believe this to be a clean and simple solution and don't see the need of making it more complex than that, but happy to refactor if the team disagrees. I also moved the flags from the array to inside the studio, since they are only used there. So it is nice (but not needed), to add the country flag when adding a new language. Setup is done through the file GOTCHAS: We can't use typescript since the file is read by next.config.mjs, and next currently doesn't accept ts in this file |
ProsEasier to read the code ConsLack of typescript because of Next config, but I don't think that will change. We should probably not spend to much time on this 😅 What do you think @nilsml ? |
I tried to explain things slightly more verbose in the satellites config, but I'm actually not sure that it's 100% correct |
...and the plot thickens The new version of the Sanity language plugin has changed the config. Name is now id and they are using - as a delimiter for language and some config changes in general |
I did a review of the code. It is definitely better than what it was, but still room for improvements. Either by creating a DSL for the config or use functional concepts, we could make it less error-prone, but at the same time we need to move on. I will create a task in the backlog for further improvements #745 I reckon this can be closed. |
TODO
Make a common type for the languages (we need to figure out how hard it is to share types across the web and sanity folders. This might be to complicated for this issue)
Avoid to use
let
in the languages file (in the web). Or at least make it easier to see what is going on hereUse less hard coded string values for datasets (I had to change from
production
too many places, ie in DesktopStructure.jsWe should add the base language explicit (for use in the document translation feature from the intl plugin). Both for the web part (next.config.js) and the documentTranslation (intl-plugin) config in Sanity
The text was updated successfully, but these errors were encountered: