Installations
npm install @kuus/gatsby-plugin-i18n
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
14.16.0
NPM Version
7.19.1
Score
24.4
Supply Chain
57.8
Quality
64.5
Maintenance
25
Vulnerability
89.7
License
Releases
Unable to fetch releases
Total Downloads
Cumulative downloads
Total Downloads
9,190
Last day
0%
1
Compared to previous day
Last week
0%
2
Compared to previous week
Last month
-12.5%
56
Compared to previous month
Last year
-46.7%
901
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
7
Peer Dependencies
5
Dev Dependencies
1
Gatsby plugin i18n
This plugin is meant to be used with netlify and its gatsby-plugin-netlify to correctly handle redirects server side. A less SEO friendly alternative would be to use this plugin alongside gatsby-plugin-meta-redirect or gatsby-plugin-client-side-redirect, they all exploit the gatsby's createRedirect
action.
Localised messages
- Components specific string are prefixed by the component name in PascalCase, e.g. for component
Header
the string prefix isHeader.
- Pages and templates specific strings are prefixed by the page component name all lowercase minus the prefix
Pages
orTemplate
, e.g. for page about the component would bePagesAbout
and the string prefix isabout.
, for the template blog-single the component would beTemplateBlogSingle
and the string prefix isblogsingle
- Generic strings not tight to any component or page in particular are prefxed with a
.
dot and begin lowercase, e.g..globalMessage
Known issues
- Gatsby generates a warning like:
1warn There are routes that match both page and redirect. 2It will result in page not being accessible; this is 3probably not intentional: 4 - page: "/" and redirect: "/" -> "/it/"
That is fine as the redirect is created with the Language
Netlify's specific option for createRedirect
and therefore the warning message is misleading as it does not take into account the language based redirect.
- Gatsby's warnings:
1warn Plugin `@kuus/gatsby-plugin-i18n` has customized the 2 built-in Gatsby GraphQL type `File`. This is allowed, 3but could potentially cause conflicts. 4warn Plugin `gatsby-plugin-mdx` has customized the 5GraphQL type `Mdx`, which has already been defined by the 6 plugin `@kuus/gatsby-plugin-i18n`. This could 7potentially cause conflicts.
are fine... We need to customise those Node's types to have a seamless localization API.
Resources
- Netlify redirects adn localization
- Gatsby netlify plugin
- Examples of internationalised Gatsby sites:
- overreacted.io We might get from there the mechanism that scan the markdown files and auto-localise links.
- Articles:
- About 404:
Similar projects
There are many on npm
.
- gatsby-plugin-intl
- using-i18n
- gatsby-plugin-i18n
- gatsby-i18n-plugin
- gatsby-plugin-intl-url
- gatsby-theme-i18n
- gatsby-plugin-translate-urls
- gatsby-theme-localization
Issues
Language based redirects
Those that use Language: locale
in the createRedirect
method, they seem to do not work at the moment, see this issue or this one for instance.
Trailing slashes
Netlify when loading a page directly or refreshing the browser when you are on a page without a trailing slash it will redirect to the same url with a trailing slash, this happens even with Pretty URLS
setting disabled on Netlify panel. See this issue. Until this issue with netlify is not solved we set by default trailing slashed on all paths with the util normaliseUrlPath
.
Custom slugs
TODO:
- Add support for server side redirects in frontmatter, see Programmatic Redirects in Gatsby
No vulnerabilities found.
No security vulnerabilities found.