0

I want to use i18next with httpbackend, but my question is now why everyone uses a backend for this why I can not create in my react folder a public folder and then load this from there ?

universe11
  • 703
  • 1
  • 11
  • 35

1 Answers1

0

There is absolutely nothing wrong with having translations client side, but there is a question of what fits better your needs.

Server Side

The range of backends is large from loading translations in the browser using xhr/fetch request to loading translations from databases or filesystem in Node.js.

Client

You are limited to having every translation on the client and editing translations might be problematic, specialy that you have to do it all by hand.

Please refer to original documentation from i18next for more informations

Damian Busz
  • 1,693
  • 1
  • 10
  • 22
  • thanks! but I dont know where the httpbackend api knows my url ? I have to set a URL that the httpbackend can fetch my files. So why no one adds a url ? they make it like this: use(Backend). and thats it. I dont understand if I make this I get error missing key – universe11 Mar 20 '22 at 22:01
  • because the default url / loadPath is: '/locales/{{lng}}/{{ns}}.json' https://github.com/i18next/i18next-http-backend#backend-options btw: here is a nice overview of how to load translations: https://www.i18next.com/how-to/add-or-load-translations – adrai Mar 21 '22 at 09:29