Open cjchiang opened 3 years ago
Currently removeLocalePart is removing everything before the first instance of a '/'. In cases where the user is switching from the default language to any other it removes the url part even if it is not a locale i.e /legal/terms -> /fr/terms.
The issue seems to be coming from https://github.com/microapps/gatsby-plugin-react-i18next/blob/c6dabc14200a68003f7b02f934fa47bacabf539f/src/useI18next.ts#L31
Not checking if the string before the first / is a locale or not.
Currently removeLocalePart is removing everything before the first instance of a '/'. In cases where the user is switching from the default language to any other it removes the url part even if it is not a locale i.e /legal/terms -> /fr/terms.
The issue seems to be coming from https://github.com/microapps/gatsby-plugin-react-i18next/blob/c6dabc14200a68003f7b02f934fa47bacabf539f/src/useI18next.ts#L31
Not checking if the string before the first / is a locale or not.