{"id":64529,"date":"2024-08-30T03:01:00","date_gmt":"2024-08-29T17:01:00","guid":{"rendered":"https:\/\/65.254.95.247\/ITblog\/?p=64529"},"modified":"2024-08-30T12:20:02","modified_gmt":"2024-08-30T02:20:02","slug":"almalinux-php-gettext-your-own-translation-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/almalinux-php-gettext-your-own-translation-tutorial\/","title":{"rendered":"AlmaLinux PHP Gettext Your Own Translation Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php\" rel=\"noopener\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"AlmaLinux PHP Gettext Your Own Translation Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text_your_own.jpg\" title=\"AlmaLinux PHP Gettext Your Own Translation Tutorial\"   \/><\/a><p class=\"wp-caption-text\">AlmaLinux PHP Gettext Your Own Translation Tutorial<\/p><\/div>\n<p>To open up yesterday&#8217;s <a title='AlmaLinux PHP Gettext Translation Tutorial' href='#alphpgtt'>AlmaLinux PHP Gettext Translation Tutorial<\/a>&#8216;s PHP Gettext Using web application to the possibility of &#8230;<\/p>\n<ul>\n<li>user supplying a new locale into the mix &#8230; and &#8230;<\/li>\n<li>user supplying their own English to &#8220;Their Newly Introduced Locale&#8221; word\/phrase translation<\/li>\n<\/ul>\n<p> &#8230; is fine and good in principle, but needs moderation, and that requires a deal of thinking.  But then we thought, as far as moderation goes, why don&#8217;t we &#8230;<\/p>\n<ul>\n<li>add to the [domain].po relevant [domain].po <i>msgid<\/i> entry a suffix that goes &#8230;<\/p>\n<p><code><br \/>\n_await_moderation_[IPaddressBasedStringWebBrowserBrandSpecific]<br \/>\n<\/code><\/p>\n<p> &#8230; allowing the creator of the translation see their translation echoed back to them, but other people see no translation should they ask for the same translation conditions.  That means if someone is not using the web application properly, only they, or people looking over their shoulder, see their own translation ideas happening ahead of a moderator stripping out from the <i>msgid<\/i> string any suffix like above if that moderator determines it is a genuine translation data item, in which case from then on all users see that translation suggestion come into &#8220;live play&#8221;.<\/p>\n<p>See how we did this with <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php---GETME\" rel=\"noopener\">the changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php---GETME\" rel=\"noopener\">get_text.php<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php\" rel=\"noopener\">PHP Gettext Using web application<\/a> you can also <a href='#myifgt'>try below<\/a>.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=\"_blank\" href='\/\/www.rjmprogramming.com.au\/ITblog\/almalinux-php-gettext-your-own-translation-tutorial\/' rel=\"noopener\">AlmaLinux PHP Gettext Your Own Translation Tutorial<\/a>.<\/p-->\n<hr>\n<p id='alphpgtt'>Previous relevant <a target=\"_blank\" title='AlmaLinux PHP Gettext Translation Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/almalinux-php-gettext-translation-tutorial\/' rel=\"noopener\">AlmaLinux PHP Gettext Translation Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php\" rel=\"noopener\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"AlmaLinux PHP Gettext Translation Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.gif\" title=\"AlmaLinux PHP Gettext Translation Tutorial\"   \/><\/a><p class=\"wp-caption-text\">AlmaLinux PHP Gettext Translation Tutorial<\/p><\/div>\n<p>With our changeover to &#8230;<\/p>\n<ul>\n<li>AlmaLinux Apache\/PHP\/MySql web hosting &#8230; using &#8230;<\/li>\n<li>PHP version <font size=1>with an<\/font> 8 <font size=1>starting it<\/font><\/li>\n<\/ul>\n<p> &#8230; it is time to revisit the PHP <a target=\"_blank\" href='https:\/\/www.php.net\/manual\/en\/book.gettext.php' title='Gettext information from php.net' rel=\"noopener\">gettext<\/a> (Human Language Translation) module, that had us reach an install situation which looked like &#8230;<\/p>\n<p><code><br \/>\n# dnf list *get*text*<br \/>\nLast metadata expiration check: 1:51:10 ago on Wed 28 Aug 2024 11:45:24 AM AWST.<br \/>\nInstalled Packages<br \/>\nea-php80-php-gettext.x86_64                                    8.0.30-4.4.8.cpanel                           @EA4-c9<br \/>\nea-php80-php-gettext-debuginfo.x86_64                          8.0.28-1.1.29.cpanel                          @EA4-c9<br \/>\nea-php81-php-gettext.x86_64                                    8.1.29-1.2.1.cpanel                           @EA4-c9<br \/>\nea-php81-php-gettext-debuginfo.x86_64                          8.1.19-2.2.1.cpanel                           @EA4-c9<br \/>\nea-php82-php-gettext.x86_64                                    8.2.22-1.2.1.cpanel                           @EA4-c9<br \/>\nea-php82-php-gettext-debuginfo.x86_64                          8.2.6-2.2.1.cpanel                            @EA4-c9<br \/>\nea-php83-php-gettext.x86_64                                    8.3.10-1.2.1.cpanel                           @EA4-c9<br \/>\ngettext.x86_64                                                 0.21-8.el9                                    @baseos<br \/>\ngettext-common-devel.noarch                                    0.21-8.el9                                    @appstream<br \/>\ngettext-devel.x86_64                                           0.21-8.el9                                    @appstream<br \/>\ngettext-libs.x86_64                                            0.21-8.el9                                    @baseos<br \/>\nAvailable Packages<br \/>\ngettext-devel.i686                                             0.21-8.el9                                    appstream<br \/>\ngettext-libs.i686                                              0.21-8.el9                                    baseos<br \/>\nmingw32-gettext.noarch                                         0.21-5.el9                                    crb<br \/>\nmingw32-gettext-static.noarch                                  0.21-5.el9                                    crb<br \/>\nmingw64-gettext.noarch                                         0.21-5.el9                                    crb<br \/>\nmingw64-gettext-static.noarch                                  0.21-5.el9                                    crb<br \/>\nocaml-gettext.x86_64                                           0.4.2-6.el9                                   crb<br \/>\nocaml-gettext-devel.x86_64                                     0.4.2-6.el9                                   crb<br \/>\nperl-Locale-gettext.x86_64                                     1.07-21.el9                                   crb<br \/>\npython3-setuptools-gettext.noarch                              0.1.3-2.el9                                   epel<br \/>\n<\/code><\/p>\n<p> &#8230; (and a &#8230;<br \/>\n<code><br \/>\ndnf install glibc-all-langpacks<br \/>\n<\/code><br \/>\n &#8230; to install more locales on AlmaLinux web server) &#8230; which you can see happening with <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.gif\" rel=\"noopener\">today&#8217;s animated GIF tutorial presentation<\/a>, as we <i>got somewhere<\/i> <font size=1>(albeit, after half a day of struggle (getting <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php-GETME\" rel=\"noopener\">from years back to &#8220;getting there&#8221;, involving three &#8220;exit&#8221; code snippet struggles (only the top one working)<\/a>), which ended when reading brice\/axice\/be&#8217;s blurb on the PHP <a target=\"_blank\" href='https:\/\/www.php.net\/manual\/en\/function.setlocale.php' title='Setlocale information from php.net' rel=\"noopener\">setlocale<\/a> advising webpage, thanks for the brilliance)<\/font> with gettext.<\/p>\n<p>Do not think of gettext as some miracle panacea for a language translation issue.  It is just a good framework to use, but you still have to do the bulk of the &#8220;hard yards&#8221; &#8230;<\/p>\n<ol>\n<li>creating [domain].po (Poedit) input files where <i>msgid<\/i> strings have translate from strings and <i>msgstr<\/i> strings have translate to strings relevant to your language locale (eg. de_DE for German) &#8230;<\/li>\n<li>convert these to [domain].mo via &#8230;<br \/>\n<code><br \/>\nmsgfmt [domain].po -o  [domain].mo<br \/>\n<\/code>\n<\/li>\n<li>for each relevant locale &#8230; you can check for relevance of via &#8230;<br \/>\n<code><br \/>\nlocale -a<br \/>\n<\/code><br \/>\n &#8230; checking\n<\/li>\n<\/ol>\n<p> &#8230; with  <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php--GETME\" rel=\"noopener\">getting the breakthrough<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php--GETME\" rel=\"noopener\">get_text.php<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php\" rel=\"noopener\">PHP Gettext Using web application<\/a> that harnessed some of the .po to .mo work we did when we presented the previous <a title='Yahoo YQL JSON Thesaurus Gettext Translation Tutorial' href='#yyqljsontgtt'>Yahoo YQL JSON Thesaurus Gettext Translation Tutorial<\/a>, the results of which are reflected in the web application below &#8230;<\/p>\n<p><iframe id=myifgt src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gettext\/get_text.php\" style=\"width:90%;height:800px;\"><\/iframe><\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=\"_blank\" href='\/\/www.rjmprogramming.com.au\/ITblog\/almalinux-php-gettext-translation-tutorial\/' rel=\"noopener\">AlmaLinux PHP Gettext Translation Tutorial<\/a>.<\/p-->\n<hr>\n<p id='yyqljsontgtt'>Previous relevant <a target=\"_blank\" title='Yahoo YQL JSON Thesaurus Gettext Translation Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/yahoo-yql-json-thesaurus-gettext-translation-tutorial\/' rel=\"noopener\">Yahoo YQL JSON Thesaurus Gettext Translation Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/AjaxYqlThesaurus.m4v\" rel=\"noopener\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Yahoo YQL JSON Thesaurus Gettext Translation Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/AjaxYqlThesaurus.jpg\" title=\"Yahoo YQL JSON Thesaurus Gettext Translation Tutorial\"   \/><\/a><p class=\"wp-caption-text\">Yahoo YQL JSON Thesaurus Gettext Translation Tutorial<\/p><\/div>\n<p>Recently we talked about PHP methods to facilitate (language) internationalization via the <a target=\"_blank\" href='http:\/\/php.net\/manual\/en\/book.gettext.php' title='Human Language and Character Encoding Support' rel=\"noopener\">&#8220;gettext&#8221;<\/a> Human Language and Character Encoding Support module with the <a target=\"_blank\" href='https:\/\/www.rjmprogramming.com.au\/ITblog\/php-gettext-internationalization-primer-tutorial\/' title='PHP Gettext Internationalization Primer Tutorial' rel=\"noopener\">PHP Gettext Internationalization Primer Tutorial<\/a>.<\/p>\n<p>Yesterday&#8217;s <a target=\"_blank\" title='Yahoo YQL Web Service JSON Thesaurus Tutorial' href='#yywsjtt' rel=\"noopener\">Yahoo YQL Web Service JSON Thesaurus Tutorial<\/a> as shown below, is a good candidate for &#8220;gettext&#8221; internationalization, and we show the files necessary to oversee yesterday&#8217;s HTML and Javascript with a layer of PHP to achieve it.  We test this on our local <a target=\"_blank\" href='https:\/\/www.mamp.info\/' title='MAMP' rel=\"noopener\">MAMP<\/a> local web server, where &#8220;gettext&#8221; is enabled (unfortunately, this is not the case with the rjmprogramming.com.au domain, so today, we only have source code rather than an additional live run &#8230; for that you can watch a video playing of a MAMP session using it <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/AjaxYqlThesaurus.m4v\" title=\"Click picture\" rel=\"noopener\">here<\/a>).<\/p>\n<p>Now this additional internationalization concerns the &#8230;<\/p>\n<ul>\n<li>language of the wording on the screen, and in error messages and titles<\/li>\n<li>starting of an execution in the same language as last used &#8230; we use PHP methods, but you could also use <a target=\"_blank\" title='Cookies' href='http:\/\/en.wikipedia.org\/wiki\/HTTP_cookie' rel=\"noopener\">Cookies<\/a> for this idea<\/li>\n<\/ul>\n<p>The downloadable PHP <a target=\"_blank\" title='Ajax_yql_thesaurus.php' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.php-GETME\" rel=\"noopener\">Ajax_yql_thesaurus.php<\/a> (we show here the changes to it from yesterday&#8217;s HTML at <a target=\"_blank\" title='Ajax_yql_thesaurus.php' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.php-GETME\" rel=\"noopener\">Ajax_yql_thesaurus.php<\/a>) calls on <a target=\"_blank\" title='localization.php' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/localization.php_GETME\" rel=\"noopener\">localization.php<\/a>.<\/p>\n<p>Sessions using <a target=\"_blank\" href='http:\/\/www.macupdate.com\/app\/mac\/22905\/poedit' title='Poedit' rel=\"noopener\">Poedit<\/a> (for our Mac laptop) resulted in the necessary translation *.po files (compiled into *.mo) &#8230;<\/p>\n<ul>\n<li><a target=\"_blank\" title=\"French\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/locale\/fr_FR\/LC_MESSAGES\/messages.po_GETME\" rel=\"noopener\">French<\/a><\/li>\n<li><a target=\"_blank\" title=\"German\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/locale\/de_DE\/LC_MESSAGES\/messages.po_GETME\" rel=\"noopener\">German<\/a><\/li>\n<li><a target=\"_blank\" title=\"Italian\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/locale\/it_IT\/LC_MESSAGES\/messages.po_GETME\" rel=\"noopener\">Italian<\/a><\/li>\n<li><a target=\"_blank\" title=\"Spanish\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/locale\/es_ES\/LC_MESSAGES\/messages.po_GETME\" rel=\"noopener\">Spanish<\/a><\/li>\n<li><a target=\"_blank\" title=\"English\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/locale\/en_EN\/LC_MESSAGES\/messages.po_GETME\" rel=\"noopener\">English<\/a><\/li>\n<\/ul>\n<p> &#8230; the languages of the YQL web service of the data emanating from its links to the <a target=\"_blank\" title='altervista thesaurus ... thanks' href='http:\/\/thesaurus.altervista.org\/' rel=\"noopener\">altervista<\/a> thesaurus web service database with Yahoo YQL website &#8230; thanks.  For the altervista thesaurus database usage it is best to request a key for your web service queries.  You fill in a word (or two, or three) of interest to search for like-minded words.<\/p>\n<p>Leave aside lots of time and\/or <strike>man<\/strike>person power for the translation work.  Hope this helps you out.<\/p>\n<hr>\n<p id='yyjtatt'>Previous relevant <a target=\"_blank\" title='Yahoo YQL JSON Thesaurus and Translation Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/\/' rel=\"noopener\">Yahoo YQL JSON Thesaurus and Translation Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.html\" rel=\"noopener\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Yahoo YQL JSON Thesaurus and Translation Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/thesaurus_plus.jpg\" title=\"Yahoo YQL JSON Thesaurus and Translation Tutorial\" id='iyy' onmouseover=\" this.src=this.src.replace('.jpg','.xpng').replace('.gif','.xjpg').replace('.png','.xgif').replace('.x','.');        \"  \/><\/a><p class=\"wp-caption-text\">Yahoo YQL JSON Thesaurus and Translation Tutorial<\/p><\/div>\n<p>Language teachers will sometimes resort to an <a target=\"_blank\" title='Language immersion information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Language_immersion' rel=\"noopener\">immersion method<\/a>, in the classroom, where the only language allowed to be spoken is the language being learnt, often the second language for the student who is being taught. <a target=\"_blank\" title='English as a Second Language information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/English_as_a_second_or_foreign_language' rel=\"noopener\">ESL<\/a> teachers face this decision sometimes. We read an interesting <a target=\"_blank\" href='http:\/\/www.spanishconversation.net\/pros--cons-of-total-immersion.html' title='Interesting article' rel=\"noopener\">article<\/a> on the subject here, and decided to use our <a target=\"_blank\" title='HTML Canvas Pros and Cons Font Colours Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html-canvas-pros-and-cons-font-colours-tutorial\/' rel=\"noopener\">Pros and Cons<\/a> web <a target=\"_blank\" title='Pros and Cons web application' href='http:\/\/www.rjmprogramming.com.au\/PHP\/prosandcons.html' rel=\"noopener\">application<\/a> to create our own view of the importance of the excellent points talked about in that article, as you can see with our report &#8230;<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/prosandcons_2015_5_19_27_49.jpg\" title=\"Pros and Cons Regarding Full Immersion Language Learning\"><\/img><\/p>\n<p>Then there are degrees of &#8220;immersion&#8221;, as well, with questions such as whether you allow the use of paper (or electronic) dictionaries and translators.  Think there is a lot of agreement that the best language learning happens with some degree of context and use of realia to help the student envisage the situations in which that vocabulary might be encountered.  However, with written work or independent study, and even in the classroom a (web application) tool to help the learner with a difficult word could help, and so we&#8217;ve extended the functionality of the previous <a target=\"_blank\" title='Yahoo YQL Web Service JSON Thesaurus Tutorial' href='#yywsjtt' rel=\"noopener\">Yahoo YQL Web Service JSON Thesaurus Tutorial<\/a> as shown below, by offering the chance for the native language be used to translate the word, and offer a list of thesaurus word lists of the language they are learning out of the list of languages below &#8230;<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<ul>\n<li><a target=\"_blank\" href=\"http:\/\/www.thefreedictionary.com\/\" rel=\"noopener\">English<\/a><\/li>\n<li><a target=\"_blank\" title=\"French\" href=\"http:\/\/www.systranet.com\/dictionary\/\" rel=\"noopener\">French<\/a><\/li>\n<li><a target=\"_blank\" title=\"German\" href=\"http:\/\/www.dict.cc\/\" rel=\"noopener\">German<\/a><\/li>\n<li><a target=\"_blank\" title=\"Italian\" href=\"http:\/\/www.wordreference.com\/iten\/\" rel=\"noopener\">Italian<\/a><\/li>\n<li><a target=\"_blank\" title=\"Spanish\" href=\"http:\/\/www.wordreference.com\/es\/en\/translation.asp\" rel=\"noopener\">Spanish<\/a><\/li>\n<\/ul>\n<p>Read more about this below as well, but this tutorial uses a YQL web service into the data emanating from its links to the <a target=\"_blank\" title='altervista thesaurus ... thanks' href='http:\/\/thesaurus.altervista.org\/' rel=\"noopener\">altervista<\/a> thesaurus web service database with Yahoo YQL website &#8230; thanks.  For the altervista thesaurus database usage it is best to request a key for your web service queries.  You fill in a word (or two, or three) of interest to search for like-minded words.<\/p>\n<p>We found useful, and thank, for this extra functionality, the tremendous <a target=\"_blank\" title='MyMemory API' href='http:\/\/mymemory.translated.net\/doc\/spec.php' rel=\"noopener\">MyMemory API<\/a> resource.<\/p>\n<p>The downloadable HTML source code for today&#8217;s tutorial you could call <a target=\"_blank\" title='yql_thesaurus.html' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.html--GETME\" rel=\"noopener\">Ajax_yql_thesaurus.html<\/a> (changed as per <a target=\"_blank\" title='Ajax_yql_thesaurus.html changes' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.html--GETME\" rel=\"noopener\">Ajax_yql_thesaurus.html<\/a>) calls on the PHP <a target=\"_blank\" title='yql_thesaurus.php' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/yql_thesaurus.php-GETME\" rel=\"noopener\">yql_thesaurus.php<\/a> (changed as per <a target=\"_blank\" title='yql_thesaurus.php changes' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/yql_thesaurus.php-GETME\" rel=\"noopener\">yql_thesaurus.php<\/a>).<\/p>\n<p>Try a <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.html\" rel=\"noopener\">live run<\/a> yourself and hope this sparks an idea or two for you.<\/p>\n<hr>\n<p id='yywsjtt'>Previous relevant <a target=\"_blank\" title='Yahoo YQL Web Service JSON Thesaurus Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/yahoo-yql-web-service-json-thesaurus-tutorial\/' rel=\"noopener\">Yahoo YQL Web Service JSON Thesaurus Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.html\" rel=\"noopener\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Yahoo YQL Web Service JSON Thesaurus Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Thesaurus.jpg\" title=\"Yahoo YQL Web Service JSON Thesaurus Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Yahoo YQL Web Service JSON Thesaurus Tutorial<\/p><\/div>\n<p>Here is a tutorial that might be re-introducing you to the Yahoo Web Services called YQL, building on previous ones here at this <a href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=YQL' title='Yahoo YQL tutorials here'>blog<\/a>.   The name is the way it is because it simplified the API aspects of its functionality for the developer to concentrate on SQL, and I&#8217;m really supportive of this concept.  You don&#8217;t have to output in JSON, as other data forms like XML are acceptable.  Let&#8217;s see what Wikipedia says about YQL below. <\/p>\n<blockquote>\n<p>Yahoo! Query Language (YQL) Gumtree Advertisementusing Android Phone Photos Tutorialis an SQL-like query language created by Yahoo! as part of their Developer Network. YQL is designed to retrieve and manipulate data from APIs through a single Web interface, thus allowing mashups that enable developers to create their own applications.[1]<\/p>\n<p>Initially launched in October 2008 with access to Yahoo APIs,[2] February 2009 saw the addition of open data tables from third parties such as Google Reader, the Guardian, and The New York Times.[3] Some of these APIs still require an API key to access them. On April 29th of 2009, Yahoo introduced the capability to execute the tables of data built through YQL using JavaScript run on the company&#8217;s servers for free.[3]<\/p>\n<\/blockquote>\n<p>So this tutorial uses a YQL web service into the data emanating from its links to the <a target=\"_blank\" title='altervista thesaurus ... thanks' href='http:\/\/thesaurus.altervista.org\/' rel=\"noopener\">altervista<\/a> thesaurus web service database with Yahoo YQL website &#8230; thanks.  For the altervista thesaurus database usage it is best to request a key for your web service queries.  You fill in a word (or two, or three) of interest to search for like-minded words.<\/p>\n<p>And what is a thesaurus?   Read what Wikipedia says <a target=\"_blank\" title='Thesaurus information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Thesaurus' rel=\"noopener\">here<\/a> but, basically, it can be thought of as a repository of a language&#8217;s list of words of a similar meaning to the word of your interest.   It is a great tool for people learning a language foreign to them, especially regarding their vocabulary.<\/p>\n<p>The two big PHP functions of use (as distinct from an Ajax approach, requiring no PHP &#8230; read on) for this are:<\/p>\n<ul>\n<li><a target=\"_blank\" title='file_get_contents' href='http:\/\/us1.php.net\/file_get_contents' rel=\"noopener\">file_get_contents<\/a><\/li>\n<li><a target=\"_blank\" title='json_decode' href='http:\/\/php.net\/manual\/en\/function.json-decode.php' rel=\"noopener\">json_decode<\/a> &#8230; when there is a data structure of any complexity, this function is highly recommended, but for today&#8217;s tutorial we do not use it, and take the opportunity to show you a solution using <a target=\"_blank\" title='Ajax information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Ajax_%28programming%29' rel=\"noopener\">Ajax<\/a> that requires no PHP &#8230;  link to some downloadable Ajax inspired HTML programming source code which you may want to rename to <a target=\"_blank\" title='yql_thesaurus.html' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.html-GETME\" rel=\"noopener\">Ajax_yql_thesaurus.html<\/a> which changes from the HTML supervising PHP approach as per <a target=\"_blank\" title='Ajax_yql_thesaurus.html changes' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.html-GETME\" rel=\"noopener\">Ajax_yql_thesaurus.html<\/a> (and then there is an <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.html\" title=\"Click picture\" rel=\"noopener\">Ajax live run<\/a>)<\/li>\n<\/ul>\n<p>Good links for information regarding this tutorial (thanks) are:<\/p>\n<ul>\n<li><a target=\"_blank\" href='http:\/\/developer.yahoo.com\/yql\/guide\/two-minute-tutorial.html' title='YQL Two Minute Tutorial' rel=\"noopener\">YQL Two Minute Tutorial<\/a> from Yahoo<\/li>\n<li><a target=\"_blank\" href='http:\/\/en.wikipedia.org\/wiki\/Yahoo!_Query_Language' title='Yahoo! Query Language' rel=\"noopener\">Yahoo! Query Language<\/a> from Wikipedia, as per quote above<\/li>\n<li><a target=\"_blank\" href='http:\/\/developer.yahoo.com\/yql\/' title='YQL Home Page' rel=\"noopener\">YQL Home Page<\/a> from Yahoo<\/li>\n<li><a target=\"_blank\" href='https:\/\/developer.yahoo.com\/yql\/console\/?q=select%20*%20from%20flickr.photos.interestingness%2820%29&#038;env=store:\/\/datatables.org\/alltableswithkeys#h=select+*+from+thesaurus+where+key%3D%22test_only%22+and+word%3D%22peace%22+and+language%3D%22en_US%22' title='YQL thesaurus help' rel=\"noopener\">YQL thesaurus help<\/a> from Yahoo<\/li>\n<li><a target=\"_blank\" title='YQL JSON Parsing Help' href='http:\/\/developer.yahoo.com\/forum\/YQL\/yql-query-intermittently-returns-no-results\/1374521623593-fa4a3519-10ae-4a17-8fd4-6de45a159d6f' rel=\"noopener\">YQL JSON Parsing Help<\/a> from YQL forum<\/li>\n<\/ul>\n<p>Another tool you should have in your armoury for jobs like this is the online JSON validator <a target=\"_blank\" title='JSON validator online' href='http:\/\/jsonlint.com\/' rel=\"noopener\">here<\/a>.  A generic JSON approach to issues could be:<\/p>\n<ol>\n<li>Type the URL you were given into a web browser address bar and have a look at it<\/li>\n<li>Type the URL you were given into http:\/\/jsonlint.com\/ and have it validated<\/li>\n<li>Understand in your own mind what would be different about 1. to make it suitable<\/li>\n<li>Incorporate findings of 3. into massaging of data between file_get_contents and json_decode<\/li>\n<\/ol>\n<p>Here is a link to some downloadable HTML programming source code which you may want to rename to <a target=\"_blank\" title='yql_thesaurus.html' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/yql_thesaurus.html_GETME\" rel=\"noopener\">yql_thesaurus.html<\/a> which calls some downloadable PHP programming source code which you may want to rename to <a target=\"_blank\" title='yql_thesaurus.php' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/yql_thesaurus.php_GETME\" rel=\"noopener\">yql_thesaurus.php<\/a> (and then there is a <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/yql_thesaurus.html\" title=\"Click picture\" rel=\"noopener\">PHP live run<\/a>).<\/p>\n<p>We thank the following free online dictionaries &#8230;<\/p>\n<ul>\n<li><a target=\"_blank\" href=\"http:\/\/www.thefreedictionary.com\/\" rel=\"noopener\">English<\/a><\/li>\n<li><a target=\"_blank\" title=\"French\" href=\"http:\/\/www.systranet.com\/dictionary\/\" rel=\"noopener\">French<\/a><\/li>\n<li><a target=\"_blank\" title=\"German\" href=\"http:\/\/www.dict.cc\/\" rel=\"noopener\">German<\/a><\/li>\n<li><a target=\"_blank\" title=\"Italian\" href=\"http:\/\/www.wordreference.com\/iten\/\" rel=\"noopener\">Italian<\/a><\/li>\n<li><a target=\"_blank\" title=\"Spanish\" href=\"http:\/\/www.wordreference.com\/es\/en\/translation.asp\" rel=\"noopener\">Spanish<\/a><\/li>\n<\/ul>\n<p>Stay tuned for an interesting blog posting tomorrow which combines the new thesaurus functionality of today&#8217;s contribution, along with the functionality <i>&#8220;smarts&#8221;<\/i> of yesterday&#8217;s <a target=\"_blank\" title='PHP\/CSS Sentence Auxiliary Verb Game Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=11513' rel=\"noopener\">PHP\/CSS Sentence Auxiliary Verb Game Tutorial<\/a>.<\/p>\n<p><b>Stop Press<\/b><\/p>\n<p>As of 14th May 2015 a blog posting called <a target=\"_blank\" title='HTML\/Javascript Homonyms Game Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/htmljavascript-homonyms-game-tutorial\/' rel=\"noopener\">HTML\/Javascript Homonyms Game Tutorial<\/a> inspired a &#8220;tweak&#8221; to the arrangement above such that a call of the web application above such as <a target=\"_blank\" title='Sense of Humour thesaurus result' href='http:\/\/www.rjmprogramming.com.au\/PHP\/YQL\/Thesaurus\/Ajax_yql_thesaurus.html?startwith=sense%20of%20humour' rel=\"noopener\">Sense of Humour<\/a> will cause the display of a lookup during the &#8220;onload&#8221; event, as required.<\/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='#d11246' onclick='var dv=document.getElementById(\"d11246\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=dictionary\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d11246' 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='#d15059' onclick='var dv=document.getElementById(\"d15059\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=ESL\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d15059' 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='#d15082' onclick='var dv=document.getElementById(\"d15082\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/?tag=gettext\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d15082' 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='#d64667' onclick='var dv=document.getElementById(\"d64667\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/translation\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d64667' 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='#d64529' onclick='var dv=document.getElementById(\"d64529\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/moderation\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d64529' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>To open up yesterday&#8217;s AlmaLinux PHP Gettext Translation Tutorial&#8216;s PHP Gettext Using web application to the possibility of &#8230; user supplying a new locale into the mix &#8230; and &#8230; user supplying their own English to &#8220;Their Newly Introduced Locale&#8221; &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/almalinux-php-gettext-your-own-translation-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,14,29,37],"tags":[4855,4843,367,611,1560,3173,1562,4888,2122,802,4887,2181,932,1559,997,1866,1300,1301,1319,1891],"class_list":["post-64529","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-operating-system","category-tutorials","tag-almalinux","tag-dnf","tag-dropdown","tag-install","tag-language","tag-language-code","tag-locale","tag-moderate","tag-moderation","tag-module","tag-msgfmt","tag-package-manager","tag-php","tag-poedit","tag-programming","tag-select","tag-translate","tag-translation","tag-tutorial","tag-user"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/64529"}],"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=64529"}],"version-history":[{"count":3,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/64529\/revisions"}],"predecessor-version":[{"id":64533,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/64529\/revisions\/64533"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=64529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=64529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=64529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}