i try to build a language selection for my Website.
I use php and Javascript.
My idea is to create for every language a php file.
For example: lang_en.php
<?php
$lang = array();
$lang[1] = "Everything is ok!";
$lang[2] = "Please select a Number.";
?>
<script language="JavaScript" type="text/javascript">
lang = new Array();
lang[1] = 'Hello, please select a Button.';
lang[2] = 'Are you sure?';
</script>
But i am not sure, is this a good solution? Or is there a better way?
Thanks in advance!
Peter
A multi-lingual website is a website where the content is written in more than one language. The information displayed in different languages is often the same, but maybe tailored for different audiences. Booking.com is an example of a multi-lingual website as its content is available in 35 different languages.
To change the language, just simply set the lang attribute. We can define it anywhere in the document, such as in the body, in the paragraph, in the heading, or in the span tag. But the best practice is to set the lang in the span tag.
Please please please don't make up your own solutions. You'll never get it as right as something that already exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With