PHP Internationalization Primer Tutorial

PHP Internationalization Primer Tutorial

PHP Internationalization Primer Tutorial

Internationalization is a word that encompasses all the efforts you make to have your website be open and approachable to any/all of the world’s Internet users. So within the concept of internationalization you could have:

  • language translation
  • monetary and currency conversions
  • timezone and date format considerations
  • social etiquette considerations
  • religious tolerance

For today’s tutorial we just touch on language translation, and do not pretend that this can be an exact science, but show you a PHP server-side method of translating website strings you use and not resort to the relatively easy techniques of the previous HTML/Javascript Internationalization Primer Tutorial of implementing a language translation strategy for your whole website. The two approaches share the same wonderful Google Translate software suite.

Today we show you a pared down webpage with several HTML p tags and one HTML select tag, where you select a language of choice and Google Translate is called via PHP’s file_get_contents method from your webpage in a translator to continue your work within a constantly translating environment … cute, huh? For first time use of a language it is a slow screen scraping technique, but henceforward it is a lot faster due to the existance of helper files written by that first slow pass. In any case, if there are too many strings to translate, it would be better to adopt the other approach of translating the whole website within Google Translate functionality, or sign up to the Google Translate API functionality from Google, or use third-party translator plugins, which are excellent these days. Click here for a live run.

Link to some downloadable PHP here for smallscale_translate_tutorial.php

Yes … well.


Previous relevant HTML/Javascript Internationalization Primer Tutorial is shown below.

HTML/Javascript Internationalization Primer Tutorial

HTML/Javascript Internationalization Primer Tutorial

Internationalization is a word that encompasses all the efforts you make to have your website be open and approachable to any/all of the world’s Internet users. So within the concept of internationalization you could have:

  • language translation
  • monetary and currency conversions
  • timezone and date format considerations
  • social etiquette considerations
  • religious tolerance

For today’s tutorial we just touch on language translation, and do not pretend that this can be an exact science, but show you a relatively easy approach to implementing a language translation strategy for your whole website, using the wonderful Google Translate software suite.

Today we show you a pared down webpage with one HTML p tag and one HTML select tag, where you select a language of choice and Google Translate envelopes your webpage in a translator to continue your work within a constantly translating environment … cute, huh? Click here for a live run. Please note that a bit of tweaking would be required for website containing GET parameters but could be worked with some smarter HTML/Javascript.

Link to some downloadable HTML/JavaScript here for GoogleTranslateTutorial.html

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Tutorials and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *