I need a web-application to be translated from English to Portuguese. Since the servers on which this application runs have no internet access, is there a way to achieve this without using a 3rd Party API. Is there a JS Library that can translate from say Language A to Language B on the client side ?
You can definitely use Java Script for that.
The library well known for translations is the i18next
You can integrate with jQuery, but I strongly recommend you using something like AngularJS or Mustache for customise your template.
If you choose use AngularJS you can have a different JSON file with your expressions, and depending on the language you are navigating, loads a different JSON file, like:
en.json, es.json, pt.json
You can use JS Cookies for saving the language as same you would do with any backend language.
Mustache is used to create templates front-side with double brackets {{custom_text}}. AngularJS uses the same idea.
The only issue if you want to use AJAX. Read more about Google Chrome --allow-file-access-from-files disabled for Chrome Beta 8
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.