Skip to content
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

On EN pages, languages display as in the configs. On all translated pages, all languages display. #164

Open
broadsign-lekevoid opened this issue Nov 10, 2022 · 2 comments

Comments

@broadsign-lekevoid
Copy link

From gatsby-config.js :

siteMetadata: {
	...
},
trailingSlash: "never",
plugins: [
	...
	{
		resolve: "gatsby-source-filesystem",
		options: {
			path: `${__dirname}/locales`,
			name: "locale",
		},
	},
	{
		resolve: "gatsby-plugin-react-i18next",
		options: {
			localeJsonSourceName: "locale",
			languages: ["en", "fr", "es"],
			defaultLanguage: "en",
			trailingSlash: "never",
			redirect: false,
			siteUrl: process.env.SITE_URL,
			i18nextOptions: {
				interpolation: {
					escapeValue: false,
				},
			},
			pages: [
				{
					matchPath: "/",
					languages: ["en", "fr"],
				},
				{
					matchPath: "/about",
					languages: ["en", "fr"],
				},
			],
		},
	},
	...
],

An example of how it display : https://gatsby5i18ntest.gatsbyjs.io/

At the top of the homepage, only the link to FR appears ; that is the correct behavior.
But if I go to /fr, then both EN and ES links appear whereas it should be EN only. Same thing happens on the /about page.

Am I missing something ?

I tried adding rules to the config like :

{
	matchPath: "/fr",
	languages: ["en", "fr"],
},
{
	matchPath: "fr",
	languages: ["en", "fr"],
},
{
	matchPath: "fr/",
	languages: ["en", "fr"],
},
{
	matchPath: "/fr/",
	languages: ["en", "fr"],
},

It doesn't change anything.

@nabilk2
Copy link

nabilk2 commented Dec 12, 2022

I'm also experiencing the same exact issue, has there been any update on this?

@0xGF
Copy link

0xGF commented Dec 12, 2022

I'm experiencing this issue with my site as-well. It seems like the plugin hooks and lang are super inconsistent and return additional lang values that dont exists (lower case and duplicates) since my upgrade to gatsby 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants