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
Making this work with Contentful #31
Comments
Giving this another short today, working in the opposite direction. Starting with the default repo and bringing in the Contentful w/ Gatsby requirements part by part, rather than bringing this repo for i18n into what I had. Will comment with findings. |
Couldn't get it working, initially I was getting this TypeError #6, then I just made it more like my previous working Contentful example on master (by copying over the components) where it does pull in the contentful content, but gives me the error in this issue description. However, this time it seems it pulls in the Contentful data but I get a weird warning at build time about the GraphQL in my
I don't get this in the master branch of my contentful working repo above, so not sure what's going on here on today's branch i18n-attempt. It seems to pull in the content from Contentful as I have access in GraphiQL, but the dynamic routes are not generated. I don't get the error in the UI quote in the issue, but I don't have my content either 😄 Any ideas? How do you debug the Gatsby build in general? I can't get a breakpoint to fire in VScode and |
As I commented over in #16, I created a repo to try and simplify things for using-contentful and this plugin. Feel free to close this issue if the other one is better to be re-opened. mccrodp/gatsby-starter-contentful-i18n#1 |
Making progress here, I've added a simple working repo example for MarkdownRemark blog with i18n working, going by your docs and some hacking. https://github.com/mccrodp/gatsby-transformer-remark-i18n Just need to modify this for working with Contentful now and get a basic example in the previous remove above. |
Awesome!!! Congratulations! =D |
Thanks @angeloocana, and cheers again for the awesome plugin. Will make sure to contribute back anything I figure out, but still early days for me here. My goal is to be able to have the default contentful example working with this i18n plugin as a starter repo available for people to use. I have some concerns at the moment though, if you have any thoughts or pointers in the right direction there it'd be much appreciated. When looking at "How it works" section of the README we need .langKey.js or .langKey.md, but if it's content coming from a CMS, these prefixed files won't exist. Is there anyway I can hook into or override that part of the code in the plugin to set the lang specific slugs based on something other than file name prefix, or extract the language via GraphQL or something? (not 100% sure how to approach it atm) If not, a work around I thought of would be to pull in the content from the CMS to markdown files first, that the plugin then reads 😂but not sure if the order of things will allow this. |
Some more thought on this and a follow up question: What else does this module do, aside from parse the files to generate locale specific prefixed paths and provide language switch selector? The way I see things at the moment, is the locale specific paths is the issue, but I can work around this by using the default
So, in that case, I can work around this without needing this functionality from this i18n plugin, but then the language selector and being about to access the other language paths based on this, is super helpful.
Thanks. |
I believe we are in business, repo working with the Contenful example: https://github.com/mccrodp/gatsby-contentful-i18n Can't get the lang selector message working at the moment though.
Any ideas there, let me know. Thanks! 😄 |
Created an issue on that over here: formatjs/formatjs#204 (comment) This seems to be working, but only for the homepage, it needs to find the locales on the other routes (product and category templates), that's my next task: https://github.com/mccrodp/gatsby-contentful-i18n |
@mccrodp commented on Tue Feb 06 2018
Hey, firstly, many thanks for this repo, so helpful (using this to migrate a personal project from Elm). Have it almost working, just some misunderstanding of the way the layouts are working.
I guess this works on something to do with:
useLangKeyLayout: true
in the gatsby.config.js file, right? Then you have youren.js
layout, etc.I've followed the Contentful example here: https://github.com/gatsbyjs/gatsby/blob/master/examples/using-contentful/src/layouts/index.js
I have tried to integrate the 2 concepts, but due the the way the layouts are perhaps, I get the below error:
My add-menu branch here shows how this is setups (simple enough at the moment). https://github.com/ahimsayoga/ahimsayogajp/blob/add-menu/src/layouts/index.js
The only real difference is the content is dynamic from Contentful and it uses
gatsby.node.js
to import content: https://github.com/ahimsayoga/ahimsayogajp/blob/add-menu/gatsby-node.js#L12It points to a template
general.js
: https://github.com/ahimsayoga/ahimsayogajp/blob/add-menu/src/templates/general.jsI'm not exactly sure if I should be importing this intl functionality to the template, or if I need to wire up the layout files for this Contentful scenario, or both. New enough to practical application of React also, so my knowledge can be lacking a bit also. Cheers!
The text was updated successfully, but these errors were encountered: