I am using Zymic, its an excellent hosting however it does not offer the php gettext extension. I am thinking about buying some hosting later on, but from now I would like the easiest solution to be able to replace the purpose of gettext, within this situation I wish to display different text (British, The spanish language, Chinese, etc...) without modyfing the file an excessive amount of (a minimum of not needing to create seaprated files for every language).
I attempted something similar to this:
<?php $lang = "" switch ($lang) situation "en": $lang = "Hello World" break situation "es": $lang = 'Hola Mundo' break ?> <div> <p><?php echo $lang?></p> </div>
After I alter the
$lang variable it really works. I am a PHP beginner and that i can't think about a method to allow it to be alternation in the browser (by visiting a link).
Or it is possible to better method of carrying this out?
I'd say Zend_translate may be the very best choice for internationalization nowadays. It's better still than gettext. See this SO Question for several arguments. This was the way i myself discovered Zend_translate.
It's a little much for that simple task you show inside your question, also it might be take a little of labor to get accustomed to it at first, however the Zend components promise excellent methods to a myriad of internationalization issues - for than simply converting words. You will find also different numbering formats, time formats, currency formats, timezones... all to become taken proper care of when internationalizing a credit card applicatoin.
It does not require any sort of extensions, and you will use areas of the Zend Framework like a simple library, there's you don't need to stick to a particular application structure or anything.