how to translate your website into any language? | Sololearn: Learn to code for FREE!


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

4/27/2020 3:49:19 PM


5 Answers

New Answer


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.


to any language, that is a lot. you can load it in Google translate.


Use google translate. It is the best option to do that.


@baha it doesn't work anymore


There is a JavaScript library i18n that you can use, also there's different library for framework specific(Vue, React, Angular)