How to translate strings in JS

前端 未结 7 1072
心在旅途
心在旅途 2021-02-10 09:52

I have a project which I want to translate into multiple languages for the PHP Part I use Zend Frameworks Zend_Translate with GetText. Now I want to translate the JS part too.

7条回答
  •  自闭症患者
    2021-02-10 10:54

    Well, you could extend strings to give them a translated-function, which looks up the receiver in a locale.

    You would use it like this:

    alert("Your favorite language is English!".translated());

    And you would be given an alert with "tu idiom prefiero es Espanol", or something

    niko

提交回复
热议问题