I am new to Web Development and I am currently writing my first web app. I am trying to implement localization and I am not sure what option I should use. I am using both spring boot and react. With spring I could use LocaleResolver and thymeleaf. And with React I could use the i18next package. So I am asking myself with would make more sense to use and why.
Thanks in advance.
Short answer: React.
Long answer:
If you are using React, probably you are not using thymeleaf
. In other words, you will probably create a big Javascript package which displays the UI, and the Spring backend will do nothing but providing some raw data .
For example, say you are building a blog. Your Spring may do something like -
mydomain.com/posts/42
, I will return him {"title": "Hello", "author": "Tom"}
And your React will do something like -
fetch('mydomain.com/posts/42')
{"title": "Hello", "author": "Tom"}
.<h1>TITLE: Hello</h1> <p>AUTHOR: Tom</p>
.Now you see that, your UI goes within the frontend. Thus it is reasonable to do localization with your UI.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.