{"id":19275,"date":"2017-12-11T16:15:12","date_gmt":"2017-12-11T14:15:12","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=19275"},"modified":"2018-01-11T21:30:44","modified_gmt":"2018-01-11T19:30:44","slug":"html5-internationalization-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/","title":{"rendered":"HTML5 Internationalization Example"},"content":{"rendered":"<p>In this post we will look at Internationalization in HTML5. We will be translating the web page to use the language chosen by the user. At the same time we will keep the process passive, in the sense that, instead of making the decision on language ourselves, we will let the user choose a language of choice from a set of options.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;tgm4cmEWcKUikZNn&#8217;]<br \/>\n&nbsp;<br \/>\nTo keep things simple we will display three options, viz., German, French and of course English. We will let the user decide after initially displaying the page in English. So lets get started with the implementation of our example.<\/p>\n<div class=\"toc\">\n<h3>Table of Content<\/h3>\n<dl>\n<dt><a href=\"#projectlayout\">1. Project Layout<\/a><\/dt>\n<dt><a href=\"#toolsandtechnologies\">2. Tools &amp; Technologies<\/a><\/dt>\n<dt><a href=\"#internationalization\">3. Internationalization<\/a><\/dt>\n<dd>\n<dl>\n<dt><a href=\"#creatingresourcefiles\">3.1. Creating Resource Files<\/a><\/dt>\n<dt><a href=\"#html5markup\">3.2. HTML5 Markup<\/a><\/dt>\n<dt><a href=\"#javascript\">3.3. JavaScript<\/a><\/dt>\n<dt><a href=\"#demonstration\">3.4. Demonstration<\/a><\/dt>\n<\/dl>\n<\/dd>\n<dt><a href=\"#runningtheproject\">4. Running the Project<\/a><\/dt>\n<dt><a href=\"#downloadthesourcecode\">5. Download the Source Code<\/a><\/dt>\n<\/dl>\n<\/div>\n<h2><a name=\"projectlayout\"><\/a>1. Project Layout<\/h2>\n<p>The project structure of our example application is as follows:<\/p>\n<figure id=\"attachment_19468\" aria-describedby=\"caption-attachment-19468\" style=\"width: 348px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/ProjectLayoutHTML5Internationalization.jpg\"><img decoding=\"async\" class=\"size-full wp-image-19468\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/ProjectLayoutHTML5Internationalization.jpg\" alt=\"\" width=\"348\" height=\"448\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/ProjectLayoutHTML5Internationalization.jpg 348w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/ProjectLayoutHTML5Internationalization-233x300.jpg 233w\" sizes=\"(max-width: 348px) 100vw, 348px\" \/><\/a><figcaption id=\"caption-attachment-19468\" class=\"wp-caption-text\">Project Layout<\/figcaption><\/figure>\n<table>\n<tbody>\n<tr>\n<td><strong><em>css<\/em><\/strong><\/td>\n<td>This folder contains the css files for the application.<\/td>\n<\/tr>\n<tr>\n<td><strong><em>js<\/em><\/strong><\/td>\n<td>We place the client side JavaScript files in this folder. These files contain JavaScript code that works on the client end in the browser.<\/td>\n<\/tr>\n<tr>\n<td><strong><em>i18n<\/em><\/strong><\/td>\n<td>This is the location of our JSON resource files, they basically contain name value pairs used in translation by our application. They play a key role in enabling support for different languages on the UI.<\/td>\n<\/tr>\n<tr>\n<td><strong><em>images<\/em><\/strong><\/td>\n<td>I have downloaded and placed images of flags of the countries whose languages we plan to support in this application. These include the french, german and british flag images.<\/td>\n<\/tr>\n<tr>\n<td><strong><em>index.html<\/em><\/strong><\/td>\n<td>This is our application&#8217;s landing page and hosts our UI.<\/td>\n<\/tr>\n<tr>\n<td><strong><em>index.js<\/em><\/strong><\/td>\n<td>Our barebones nodejs web server resides in this file. All our server side JavaScript code sits in this file. It is the entry point of our application.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><a name=\"toolsandtechnologies\"><\/a>2. Tools &amp; Technologies<\/h2>\n<p>To build the application for this example, I have used the following toolset. Some of them are required whilst others could be replaced by tools of your own choice.<\/p>\n<ol>\n<li>HTML5<\/li>\n<li>CSS<\/li>\n<li>JavaScript<\/li>\n<li><a href=\"https:\/\/nodejs.org\/en\/download\/\" target=\"_blank\" rel=\"noopener\">Nodejs v6.3.0<\/a><\/li>\n<li><a href=\"https:\/\/www.npmjs.com\/package\/express\" target=\"_blank\" rel=\"noopener\">Express<\/a><\/li>\n<li><a href=\"https:\/\/code.visualstudio.com\/download\" target=\"_blank\" rel=\"noopener\">Visual Studio Code IDE<\/a><\/li>\n<\/ol>\n<p>Node.js, in essence, is JavaScript on the server-side. The Express module is used to create a barebones server to serve files and resources to the browser. I prefer the Visual Studio Code IDE but you can use any text editor of choice.<\/p>\n<h2><a name=\"internationalization\"><\/a>3. Internationalization<\/h2>\n<p>To implement our internationalization example we will proceed stepwise, first we will create the language resource files next we write markup. Then we use JavaScript to enable the user to transition from one language to another for the UI.<\/p>\n<h3><a name=\"creatingresourcefiles\"><\/a>3.1. Creating Resource files<\/h3>\n<p>We will create resource files that will allow us to replace the text with their translated one depending on the language the user switches to. These resource files are in <code>JSON<\/code> format and are basically key-value pairs. The key being the value of the <code>data-langkey<\/code> attribute of tags in the HTML markup. So in a file named <code>france.json<\/code>, for example, will be keys and corresponding text in the french language.<\/p>\n<p>We use three resource files in this application one each for the three languages we intend to support in our example, i.e., <code>france.json<\/code>, <code>germany.json<\/code> and <code>britain.json<\/code>. I have created these by getting translations from Google Translate. These files look like below:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>france.json<\/em><\/span><\/p>\n<pre class=\"brush: js;\">{\r\n    \"Name\": \"Pr\u00e9nom\",\r\n    \"Company\": \"Compagnie\",\r\n    \"Email Address\":\"Adresse e-mail\",\r\n    \"Mobile No.\": \"Num\u00e9ro de portable\",\r\n    \"Application Form\":\"Formulaire de demande\",\r\n    \"Telephone No.\":\"Num\u00e9ro de t\u00e9l\u00e9phone\",\r\n    \"Gender\":\"Le genre\",\r\n    \"Male\": \"M\u00e2le\",\r\n    \"Female\":\"Femelle\",\r\n    \"Prefer not to say\":\"Je pr\u00e9f\u00e8re ne pas le dire\",\r\n    \"WCG -- HTML5 Internationalization Example\": \"WCG - Exemple d'internationalisation HTML5\"\r\n}\r\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>germany.json<\/em><\/span><\/p>\n<pre class=\"brush: js;\">{\r\n    \"Name\": \"Name\",\r\n    \"Company\": \"Unternehmen\",\r\n    \"Email Address\":\"E-Mail-Addresse\",\r\n    \"Mobile No.\": \"Handynummer\",\r\n    \"Application Form\": \"Anmeldeformular\",\r\n    \"Telephone No.\":\"Telefonnummer\",\r\n    \"Gender\":\"Geschlecht\",\r\n    \"Male\":\"M\u00e4nnlich\",\r\n    \"Female\": \"Weiblich\",\r\n    \"Prefer not to say\":\"Mache lieber keine Angabe\",\r\n    \"WCG -- HTML5 Internationalization Example\": \"WCG - HTML5 Internationalisierung Beispiel\"\r\n}\r\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>britain.json<\/em><\/span><\/p>\n<pre class=\"brush: js;\">{\r\n    \"Name\": \"Name\",\r\n    \"Company\": \"Company\",\r\n    \"Email Address\":\"Email Address\",\r\n    \"Mobile No.\": \"Mobile No.\",\r\n    \"Application Form\": \"Application Form\",\r\n    \"Telephone No.\":\"Telephone No.\",\r\n    \"Gender\":\"Gender\",\r\n    \"Male\":\"Male\",\r\n    \"Female\": \"Female\",\r\n    \"Prefer not to say\":\"Prefer not to say\",\r\n    \"WCG -- HTML5 Internationalization Example\": \"WCG -- HTML5 Internationalization Example\"\r\n}\r\n<\/pre>\n<h3><a name=\"html5markup\"><\/a>3.2. HTML5 Markup<\/h3>\n<p>We will implement a generic application form to demonstrate internationalization. Following markup spins up a application form for us:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>index.html<\/em><\/span><\/p>\n<pre class=\"brush: html;\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n    &lt;head&gt;\r\n    &lt;meta charset=\"utf-8\"&gt;\r\n    &lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"&gt;\r\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;\r\n&lt;!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --&gt;\r\n    &lt;title&gt;WCG -- HTML5 Internationalization Example &lt;\/title&gt;\r\n\r\n    &lt;link rel=\"stylesheet\" href=\"css\/html5.internationalization.css\" type=\"text\/css\" \/&gt;\r\n&lt;!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --&gt;\r\n&lt;!-- WARNING: Respond.js doesn't work if you view the page via file:\/\/ --&gt;\r\n&lt;!--[if lt IE 9]&gt;\r\n&lt;script src=\"https:\/\/oss.maxcdn.com\/html5shiv\/3.7.3\/html5shiv.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script src=\"https:\/\/oss.maxcdn.com\/respond\/1.4.2\/respond.min.js\"&gt;&lt;\/script&gt;\r\n&lt;![endif]--&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;h1 data-langkey=\"WCG -- HTML5 Internationalization Example\"&gt;WCG -- HTML5 Internationalization Example &lt;\/h1&gt;\r\n    &lt;div id='languages'&gt;\r\n        &lt;img src='images\/if_FR_167740.png' class='language' data-lang='france' alt='French Flag' \/&gt;\r\n        &lt;img src=\"images\/if_DE_167808.png\" class='language' data-lang='germany' alt='German Flag' \/&gt;\r\n        &lt;img src=\"images\/if_GB_167794.png\" class='language' data-lang='britain' alt='British Flag' \/&gt;\r\n    &lt;\/div&gt;\r\n    &lt;fieldset&gt;\r\n        &lt;legend&gt;\r\n            &lt;span data-langkey=\"Application Form\"&gt;Application Form&lt;\/span&gt;\r\n        &lt;\/legend&gt;\r\n        &lt;span data-langkey=\"Name\"&gt;Name&lt;\/span&gt;&lt;br \/&gt;&lt;input type=\"text\" \/&gt;&lt;br \/&gt;\r\n        &lt;span data-langkey=\"Company\"&gt;Company&lt;\/span&gt;&lt;br \/&gt;&lt;input type='text' \/&gt;&lt;br \/&gt;\r\n        &lt;span data-langkey=\"Mobile No.\"&gt;Mobile No.&lt;\/span&gt;&lt;br \/&gt;&lt;input type='text' \/&gt;&lt;br \r\n        \/&gt;\r\n        &lt;span data-langkey=\"Telephone No.\"&gt;Telephone No.&lt;\/span&gt;&lt;br \/&gt;&lt;input type='text' \r\n        \/&gt;&lt;br \/&gt;\r\n        &lt;label data-langkey=\"Gender\"&gt;Gender&lt;\/label&gt;&lt;br \/&gt;\r\n        &lt;select&gt;\r\n            &lt;option data-langkey=\"Male\"&gt;Male&lt;\/option&gt;\r\n            &lt;option data-langkey=\"Female\"&gt;Female&lt;\/option&gt;\r\n            &lt;option data-langkey=\"Prefer not to say\"&gt;Prefer not to say&lt;\/option&gt;\r\n        &lt;\/select&gt;\r\n    &lt;\/fieldset&gt;\r\n\r\n    &lt;script src='js\/html5.internationalization.js' &gt;&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>One thing to notice is the decoration of each tag with text data with the attribute <code>data-langkey<\/code>. This proves to be a key in our attempt to translate all the text in the page to another language. We use the key of a tag to look up the translation of its text in our resource files. We replace the <code>innerText<\/code> of a tag with the value from the resource file. The UI of our application looks like below in browser.<\/p>\n<figure id=\"attachment_19478\" aria-describedby=\"caption-attachment-19478\" style=\"width: 764px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/ScreenGrabInternationlizationUI.jpg\"><img decoding=\"async\" class=\"size-full wp-image-19478\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/ScreenGrabInternationlizationUI.jpg\" alt=\"\" width=\"764\" height=\"440\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/ScreenGrabInternationlizationUI.jpg 764w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/ScreenGrabInternationlizationUI-300x173.jpg 300w\" sizes=\"(max-width: 764px) 100vw, 764px\" \/><\/a><figcaption id=\"caption-attachment-19478\" class=\"wp-caption-text\">Screen Layout<\/figcaption><\/figure>\n<h3><a name=\"javascript\"><\/a>3.3. JavaScript<\/h3>\n<p>Now that we have the resource files and the markup in place let us write some JavaScript to make it all tick. In our code we bind to the click event of each flag icon that we are displaying. On trigger of the event we send an <code>AJAX<\/code> request to the server to fetch the correct resource file with the translations.<\/p>\n<p>The name of the resource file is again picked up from the <code>data-lang<\/code> attribute of the respective image tags. Once we receive the same we go about translating the text in the UI with appropriate translations from the resource file. Our code looks like below:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>html5.internationalization.example.js<\/em><\/span><\/p>\n<pre class=\"brush: js;\">var languages = Array.from(document.getElementsByClassName('language'));\r\nvar xhttp = new XMLHttpRequest();\r\nvar langDocument = {};\r\n\r\nlanguages.forEach(function(value, index){\r\n    languages[index].addEventListener('click', function(){\r\n        switchLanguage(this.dataset.lang);\r\n    });\r\n});\r\nxhttp.onreadystatechange = function(){\r\n    if (this.readyState === 4 &amp;&amp; this.status === 200) {\r\n        langDocument = JSON.parse(this.responseText);\r\n        processLangDocument();\r\n    }\r\n};\r\nfunction switchLanguage(language){\r\n    xhttp.open(\"GET\", \"i18n\/\" + language + \".json\", true);\r\n    xhttp.setRequestHeader(\"Content-type\", \"application\/json\");\r\n    xhttp.send();\r\n}\r\nfunction processLangDocument(){\r\n    var tags = document.querySelectorAll('span,img,a,label,li,option,h1,h2,h3,h4,h5,h6');\r\n    Array.from(tags).forEach(function(value, index){\r\n        var key = value.dataset.langkey;\r\n        if(langDocument[key]) value.innerText = langDocument[key];\r\n    });\r\n}\r\n<\/pre>\n<h3><a name=\"demonstration\"><\/a>3.4. Demonstration<\/h3>\n<p>Now that we have all the pieces in place, let us see the results at runtime. We run the project and navigate to the URL <code>http:\/\/localhost:8090\/index.html<\/code> which displays the following:<\/p>\n<p>If we click on any of the flag icons we should see the switch to the appropriate language. Below are the results when we click on the german flag:<\/p>\n<figure id=\"attachment_19481\" aria-describedby=\"caption-attachment-19481\" style=\"width: 767px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/LandingPageInGerman.jpg\"><img decoding=\"async\" class=\"size-full wp-image-19481\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/LandingPageInGerman.jpg\" alt=\"\" width=\"767\" height=\"453\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/LandingPageInGerman.jpg 767w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/LandingPageInGerman-300x177.jpg 300w\" sizes=\"(max-width: 767px) 100vw, 767px\" \/><\/a><figcaption id=\"caption-attachment-19481\" class=\"wp-caption-text\">Landing Page &#8212; German<\/figcaption><\/figure>\n<p>Similarly the french version of the page looks like below:<\/p>\n<figure id=\"attachment_19482\" aria-describedby=\"caption-attachment-19482\" style=\"width: 763px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/LandingPageFrench.jpg\"><img decoding=\"async\" class=\"size-full wp-image-19482\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/LandingPageFrench.jpg\" alt=\"\" width=\"763\" height=\"458\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/LandingPageFrench.jpg 763w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/LandingPageFrench-300x180.jpg 300w\" sizes=\"(max-width: 763px) 100vw, 763px\" \/><\/a><figcaption id=\"caption-attachment-19482\" class=\"wp-caption-text\">Landing Page &#8212; French<\/figcaption><\/figure>\n<h2><a name=\"runningtheproject\"><\/a>4. Running the Project<\/h2>\n<p>To run the project, Run the commands below at the root of the project:<\/p>\n<pre class=\"brush: bash;\">&gt; npm install\r\n<\/pre>\n<p>then<\/p>\n<pre class=\"brush: bash;\">&gt; node index.js\r\n<\/pre>\n<p>Now navigate to the URL <code>http:\/\/localhost:8090\/index.html<\/code> in a browser of choice. This should take us to the landing page of the application.<\/p>\n<h2><a name=\"downloadthesourcecode\"><\/a>5. Download the Source Code<\/h2>\n<p>This was a look at the HTML5 Internationalization Example<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here : <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/12\/WCG-HTML5-Internationalization-Example.zip\"><strong>WCG &#8212; HTML5 Internationalization Example<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this post we will look at Internationalization in HTML5. We will be translating the web page to use the language chosen by the user. At the same time we will keep the process passive, in the sense that, instead of making the decision on language ourselves, we will let the user choose a language &hellip;<\/p>\n","protected":false},"author":213,"featured_media":914,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-19275","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html5"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HTML5 Internationalization Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this post we will look at Internationalization in HTML5. We will be translating the web page to use the language chosen by the user. At the same time\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTML5 Internationalization Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this post we will look at Internationalization in HTML5. We will be translating the web page to use the language chosen by the user. At the same time\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-11T14:15:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-11T19:30:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Siddharth Seth\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Siddharth Seth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/\"},\"author\":{\"name\":\"Siddharth Seth\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592\"},\"headline\":\"HTML5 Internationalization Example\",\"datePublished\":\"2017-12-11T14:15:12+00:00\",\"dateModified\":\"2018-01-11T19:30:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/\"},\"wordCount\":923,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"articleSection\":[\"HTML5\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/\",\"name\":\"HTML5 Internationalization Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"datePublished\":\"2017-12-11T14:15:12+00:00\",\"dateModified\":\"2018-01-11T19:30:44+00:00\",\"description\":\"In this post we will look at Internationalization in HTML5. We will be translating the web page to use the language chosen by the user. At the same time\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML5\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/html5\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"HTML5 Internationalization Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592\",\"name\":\"Siddharth Seth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"caption\":\"Siddharth Seth\"},\"description\":\"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.\",\"sameAs\":[\"https:\/\/www.webcodegeeks.com\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/siddharth-seth\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTML5 Internationalization Example - Web Code Geeks - 2026","description":"In this post we will look at Internationalization in HTML5. We will be translating the web page to use the language chosen by the user. At the same time","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/","og_locale":"en_US","og_type":"article","og_title":"HTML5 Internationalization Example - Web Code Geeks - 2026","og_description":"In this post we will look at Internationalization in HTML5. We will be translating the web page to use the language chosen by the user. At the same time","og_url":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-12-11T14:15:12+00:00","article_modified_time":"2018-01-11T19:30:44+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","type":"image\/jpeg"}],"author":"Siddharth Seth","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Siddharth Seth","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/"},"author":{"name":"Siddharth Seth","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592"},"headline":"HTML5 Internationalization Example","datePublished":"2017-12-11T14:15:12+00:00","dateModified":"2018-01-11T19:30:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/"},"wordCount":923,"commentCount":2,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","articleSection":["HTML5"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/","url":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/","name":"HTML5 Internationalization Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","datePublished":"2017-12-11T14:15:12+00:00","dateModified":"2018-01-11T19:30:44+00:00","description":"In this post we will look at Internationalization in HTML5. We will be translating the web page to use the language chosen by the user. At the same time","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-internationalization-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"HTML5","item":"https:\/\/www.webcodegeeks.com\/category\/html5\/"},{"@type":"ListItem","position":3,"name":"HTML5 Internationalization Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592","name":"Siddharth Seth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","caption":"Siddharth Seth"},"description":"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.","sameAs":["https:\/\/www.webcodegeeks.com"],"url":"https:\/\/www.webcodegeeks.com\/author\/siddharth-seth\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/19275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/213"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=19275"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/19275\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/914"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=19275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=19275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=19275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}