Supporting multiple languages in HTML web application using defines

Hi,

I'm redeveloping an application written in php with just HTML and javascript using a bootstrap template and sql server back end.

Each HTML pages needs to be supported in different languages including Right to Left ones and UTF8 encoding.

My question is can I have one set of HTML pages with defines that get replaced depending on what language is required?

Does anyone know how best to achieve this without duplicating every html page in every language?

Thanks
MOSSPOINTAsked:
Who is Participating?
 
Marco GasiFreelancerCommented:
It dinamically loads all lang files when you load the page.
Then, clicking on the link to change the lang the correct file are loaded and all phrases are translated.
All you need to do is to prepare translations files and set the attribute lang to the starting language for any element you want translate.
Let'say the main language is english, you'll have a markup like this:

<div id='content'>
    <h2 lang='en'>Hello</h2>
    <p lang='en'>Good morning</p>
</div>

Open in new window

Then you write a file for each language you want your text is translated to. In my example above I used a file called it.json to translate my text to italian.

The plugin is well documented and the page linked above, in addition to provide the download link, gives you all the info you need to get started.
0
 
Marco GasiFreelancerCommented:
I use this jquery plugin: https://github.com/irrelon/jquery-lang-js
0
 
Marco GasiFreelancerCommented:
It doesn't use defines, but json files where you have to write translations a value-pairs:

it.json
{
   token:
   {
      "Hello": "Ciao",
      "Goor morning": "Buongiorno"
    }
}

Open in new window

0
 
MOSSPOINTAuthor Commented:
Blimey, how does that work?
0
 
MOSSPOINTAuthor Commented:
Thanks for the answer.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.