{"id":5144,"date":"2013-11-11T05:05:18","date_gmt":"2013-11-10T18:05:18","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=5144"},"modified":"2013-11-11T05:05:18","modified_gmt":"2013-11-10T18:05:18","slug":"php-internationalization-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-internationalization-primer-tutorial\/","title":{"rendered":"PHP Internationalization Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/GoogleTranslate\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP Internationalization Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/GoogleTranslate\/smallscale_translate_tutorial.jpg\" title=\"PHP Internationalization Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">PHP Internationalization Primer Tutorial<\/p><\/div>\n<p>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&#8217;s Internet users.   So within the concept of internationalization you could have: <\/p>\n<p><\/p>\n<ul>\n<li>language translation<\/li>\n<li>monetary and currency conversions<\/li>\n<li>timezone and date format considerations<\/li>\n<li>social etiquette considerations<\/li>\n<li>religious tolerance<\/li>\n<\/ul>\n<p>For today&#8217;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 <a target=_blank title='' href='#hjipt'>HTML\/Javascript Internationalization Primer Tutorial<\/a> of implementing a language translation strategy for your whole website.   The two approaches share the same wonderful <a target=_blank href=\"http:\/\/translate.google.com\" title='Google Translate'>Google Translate<\/a> <a target=_blank href=\"http:\/\/translate.google.com\/?sl=nl\" title='Google Translate rules'>software<\/a> suite.<\/p>\n<p>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&#8217;s <a target=_blank title='file_get_contents' href='http:\/\/us3.php.net\/file_get_contents'>file_get_contents<\/a> method from  your webpage in a translator to continue your work within a constantly translating environment &#8230; cute, huh?   For first time use of a language it is a slow <a target=_blank title='Data scraping information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Data_scraping'>screen scraping<\/a> 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 <a target=_blank title='Google Translate API' href='https:\/\/developers.google.com\/translate\/'>Google<\/a>, or use third-party translator plugins, which are excellent these days.   Click <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/GoogleTranslate\/\" title='Live run'>here<\/a> for a live run.<\/p>\n<p>Link to some downloadable PHP here for <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/PHP\/GoogleTranslate\/smallscale_translate_tutorial.php_GETME' title='Google Translate tutorial'>smallscale_translate_tutorial.php<\/a><\/p>\n<p>Yes &#8230; <a target=_blank title='Monty Python' href='http:\/\/www.youtube.com\/watch?v=G6D1YI-41ao'>well<\/a>.<\/p>\n<hr \/>\n<p id='hjipt'>Previous relevant <a target=_blank title='' href='?p=3954'>HTML\/Javascript Internationalization Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Google\/Translate\/GoogleTranslatePrimer.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"HTML\/Javascript Internationalization Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Google\/Translate\/GoogleTranslatePrimer.jpg\" title=\"HTML\/Javascript Internationalization Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">HTML\/Javascript Internationalization Primer Tutorial<\/p><\/div>\n<p>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&#8217;s Internet users.   So within the concept of internationalization you could have: <\/p>\n<p><\/p>\n<ul>\n<li>language translation<\/li>\n<li>monetary and currency conversions<\/li>\n<li>timezone and date format considerations<\/li>\n<li>social etiquette considerations<\/li>\n<li>religious tolerance<\/li>\n<\/ul>\n<p>For today&#8217;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 <a target=_blank href=\"http:\/\/translate.google.com\" title='Google Translate'>Google Translate<\/a> <a target=_blank href=\"http:\/\/translate.google.com\/?sl=nl\" title='Google Translate rules'>software<\/a> suite.<\/p>\n<p>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 &#8230; cute, huh?   Click <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Google\/Translate\/\" title='Live run'>here<\/a> 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.<\/p>\n<p>Link to some downloadable HTML\/JavaScript here for <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Google\/Translate\/GoogleTranslateTutorial.html_GETME' title='Google Translate tutorial'>GoogleTranslateTutorial.html<\/a><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d3954' onclick='var dv=document.getElementById(\"d3954\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=HTML\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d3954' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d5144' onclick='var dv=document.getElementById(\"d5144\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=HTML\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d5144' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s Internet users. So within the concept of internationalization you could have: language translation monetary and currency &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-internationalization-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[532,620,932,997,1319,1352],"class_list":["post-5144","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-google-translate","tag-internationalization","tag-php","tag-programming","tag-tutorial","tag-utf-8"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/5144"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=5144"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/5144\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=5144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=5144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=5144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}