F
F
frontendo2018-03-11 00:01:10
JavaScript
frontendo, 2018-03-11 00:01:10

Is it better to do localization on the server side or on the client side?

The question is in the title. The server written on the node gives the client (it is on vue.js) different data, for example, data for building forms, including labels, placeholders, etc., data for tables (including table headers). I’ve been thinking for a long time where it’s more correct to translate phrases, on a server when preparing data or on a client when loading an application, send a dictionary (fully or partially transfer when sending data) with the desired language and let the translation be carried out on the client

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Proskurin, 2018-03-11
@frontendo

If this is a web application, then there is not much difference. You can simply send the localization file from the server to the selected language in JSON (do not drag all the dictionaries, but only to the selected language), and install some i18n plugin in Vue and then write in the templates where message.hello is the key in the dictionary, and call $t("message.hello") will return the hello string in the currently selected language.

T
ThunderCat, 2018-03-11
@ThunderCat

EMNIP content rendered through js is not indexed very well. But it was before, I can’t say for sure how search engines look at content now. Another caveat - dragging a dictionary to the client every time is not a good idea. Another question with the url - it should be different for different languages, that is, storing the current language in a cookie or localstorage is a bad idea.
UPD: IMHO the best option is to send already localized content from the server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question