-2

I try to make my gatsby page multilingual. I am using gatsby-plugin-react-i18next, i18next and react-i18next like in documentation.

i18n adds language prefix but page url is still the same. How i can translate friendly url? i have: domain/es/hello-world but i want: domain/es/hola-mundo

Is there a simple solution to this in GatsbyJS or is it more complicated?

Cirocki
  • 1
  • 1

2 Answers2

0

I have found a solution to our problem. I have created a .json file with the original path and the one I want to change. For example: /es/contact/": "/es/contacto.

I create this file manually, and I add a path for each page that I want to change the path. Then, in the gataby-node file, I create the oncreatepage api (there is documentation for this api). In this function, I take the page parameter.

if page.path == to some .json file path, change the path to that of the .json file.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
0

Thks for help. Finally i found perfect answer for my needs. gatsby-plugin-i18n-l10n have all i need for multilingual gatsby website with url translation too. I really recommend this module and I appreciate the work of the creators.

Here is link to github where you can find that plugin:

gatsby-plugin-i18n-l10n

Cirocki
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 21 '23 at 17:20