microapps/gatsby-plugin-react-i18next

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

broadsign-lekevoid opened this issue · 2 comments

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.

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

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.