+ 2
how to translate your website into any language?
I wanted to know that was it possible that in my web page there is an option through which anyone can change the language of my web page
5 Réponses
+ 12
Developers store translations in special files. Syntax of these files is project dependent. For instance, JavaScript project would use json format, while PHP project would use associative array format. Again, the choice depends on project requirements. It could be also yaml, xml etc.
It looks something like this:
[
'greetingsKey' => [
'en' => 'Hello',
'ru' => 'Привет'
],
'byeKey' => [
'en' => 'Goodbye',
'ru' => 'Пока'
]
]
Then you use this translation file in your project:
<p>{{ translate('greetingsKey' ) }}</p>
But this is very framework dependent. Each framework has its own translation configuration.
+ 2
to any language, that is a lot.
you can load it in Google translate.
+ 2
Use google translate. It is the best option to do that.
+ 1
@baha it doesn't work anymore
+ 1
There is a JavaScript library i18n that you can use, also there's different library for framework specific(Vue, React, Angular)