How to internationalize html pages

Is there a way for user locale based html internationalization pages? I had a website developed using html pages, but now I will be asked to internationalize this site in 4 different languages.

I know how to do this using the Spring Framework through resource packages, but I wanted to know if there is a way to do something similar using HTML pages, so you just need to write code that considers internationalization, and just keep adding resource packages which locale to choose when a user accesses a website?

+4
source share
4 answers

I just developed a solution a little easier using the CSS content property: https://github.com/k-yak/stati18n Take a look, all the information is available in the readme file.

+5
source

Or how about this?

How does internationalization work in JavaScript?

If you cannot do Javascript, you will have to use some form of template or dispatching. It is either respectively:

  • Use JSP and Spring Message taglib (or any other template language that supports i18n)
  • For each locale, you copy all the HTML pages into the locale directory, and then submit to the directory based on the locale (I do not recommend this).

What I personally do is use jMustache, which is not a template language, and then for each page (or many pages) I will have a query controller that will load all translations for the query locale into the Map object that I pass jMustache ( see Option 2 of my answer here: fooobar.com/questions/653784 / ... ).

+1
source

If you save your site statically, you will have several copies of your site if you cannot dynamically change the page using javascript. But you also want the URL to contain language code to maintain state and be good for SEO.

I developed this free solution. http://www.sitetran.com/

0
source

All Articles