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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MOSSPOINTAuthor Commented:
Thanks for the answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Applications

From novice to tech pro — start learning today.