HTML multi-languages (No PHP)

Greetings,

You know the websites where it has a small icon somewhere “EN”, “AR” or “FR” and when you click it, it changes the entire website’s language, and sometimes flip the design depending on the language reading direction!

I did some search and I found that I should use XML…or PHP (According to other threads in this community)

Can we discuss this so I could learn more about it?

Thank you!

Xml(Extended Mark Up Language) while HTML(Hyper Text Mark Up language ) For this you can choose XML, as it is the way to the solution of your problem.

Color me curious as that is not an answer I’d have given.

How do you see XML (but not HTML?) as being the solution?

3 Likes

So how to do it?

Create another HTML file and change the language and connect it with the main HTML??
(I don’t think so, it’s a bad practice…there has to be another way)

One way to do it is say to have an index-en.html file with flags linking to index-fr.html, index-it.html etc

Alternatively a separate subdirectory for each language.

There are.

But you did say no PHP

The various translations need to be somewhere and without using server-side to put together the output you are limiting yourself.

Without using separate HTML files the only alternative I can think of is to use JavaScript. But that would be bad practice.

2 Likes

You can alternatively use Jquery and set a cookie based on the country code. I’ve done it with both PHP and Jquery before.


Darn, @Mittineague beat me to it. But yes. The best option is to use PHP and a lot of us PHP users can help assist you if you are stuck.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.