<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shubham Singh Chahar</title>
    <description>The latest articles on DEV Community by Shubham Singh Chahar (@shubhamsinghchahar).</description>
    <link>https://dev.to/shubhamsinghchahar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F360828%2Fa1aaa1ff-e5fd-45ba-acad-aca8a8dc4dcc.png</url>
      <title>DEV Community: Shubham Singh Chahar</title>
      <link>https://dev.to/shubhamsinghchahar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shubhamsinghchahar"/>
    <language>en</language>
    <item>
      <title>Creating GISTs from a GITHUB Repo on the go</title>
      <dc:creator>Shubham Singh Chahar</dc:creator>
      <pubDate>Thu, 16 Jul 2020 03:41:21 +0000</pubDate>
      <link>https://dev.to/shubhamsinghchahar/creating-gists-from-a-github-repo-on-the-go-3dgf</link>
      <guid>https://dev.to/shubhamsinghchahar/creating-gists-from-a-github-repo-on-the-go-3dgf</guid>
      <description>&lt;p&gt;Github provides you with the functionality to make and embed a gist anywhere on the internet, but there's something missing, what if we want to share a gist of code from existing repo without the need of creating a new gist for it?&lt;/p&gt;




&lt;h3&gt;
  
  
  TLDR;
&lt;/h3&gt;

&lt;p&gt;Hello there,&lt;/p&gt;

&lt;p&gt;For anyone who works with documenting or creating how-tos and tutorials on software development, we know how hard it is to include a chunk of code in between.&lt;/p&gt;

&lt;p&gt;There are few options that we can consider -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can include a code block in between and write down all the code we need to display.&lt;/li&gt;
&lt;li&gt;We could create a gist on GitHub, but creating and managing gists is tedious.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But then, we have the code in a repository most of the time, after all, one of the principle we developers adhere to is DRY (Don't repeat yourself).&lt;/p&gt;

&lt;p&gt;This is where git-repo-gist comes in, as the name suggests, this utility allows you to create a gist out of any file from a GitHub repository.&lt;/p&gt;




&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Two modes available

&lt;ul&gt;
&lt;li&gt;Script and Iframe&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Supported Languages (I suppose all the popular languages are supported but the list below is for sure)

&lt;ul&gt;
&lt;li&gt;typescript&lt;/li&gt;
&lt;li&gt;javascript&lt;/li&gt;
&lt;li&gt;dart&lt;/li&gt;
&lt;li&gt;json&lt;/li&gt;
&lt;li&gt;php&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  How to use it
&lt;/h3&gt;

&lt;p&gt;There are few simple steps to get gist out of code - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get the &lt;code&gt;uri&lt;/code&gt; to the &lt;code&gt;raw&lt;/code&gt; file, for eg &lt;code&gt;https://raw.githubusercontent.com/thefallenmerc/git-repo-gist/master/app.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;extract the part starting from your username till end, (everything after &lt;code&gt;https://raw.githubusercontent.com/&lt;/code&gt;), we get &lt;code&gt;thefallenmerc/git-repo-gist/master/app.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Append this to our base url with any of the option available in between, the solution is hosted at &lt;a href="https://git-repo-gist.herokuapp.com/"&gt;https://git-repo-gist.herokuapp.com/&lt;/a&gt;, thus we get &lt;code&gt;https://git-repo-gist.herokuapp.com/&amp;lt;option&amp;gt;/thefallenmerc/git-repo-gist/master/app.js&lt;/code&gt;, where option can have the following value -

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;gist&lt;/strong&gt;: gives back and actual gist script&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;framed&lt;/strong&gt;: gives back an iframe with the gist in it&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Link to Git Repo Gist - &lt;a href="https://git-repo-gist.herokuapp.com/"&gt;Git Repo Gist&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/thefallenmerc"&gt;
        thefallenmerc
      &lt;/a&gt; / &lt;a href="https://github.com/thefallenmerc/git-repo-gist"&gt;
        git-repo-gist
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h2&gt;
Github Repo Gist&lt;/h2&gt;
 &lt;p&gt;This project imitates the Gist functionality provided by github but with a little twist, it works for
    repository source files.&lt;/p&gt;
  &lt;p&gt;
    &lt;a href="https://github.com/thefallenmerc/git-repo-gist/issues"&gt;
      &lt;img alt="Issues" src="https://camo.githubusercontent.com/7b51645cbf938fddef87bdc6dd9021ab79aecb44/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f74686566616c6c656e6d6572632f6769742d7265706f2d676973743f636f6c6f723d303038386666"&gt;
    &lt;/a&gt;
    &lt;a href="https://github.com/thefallenmerc/git-repo-gist/pulls"&gt;
      &lt;img alt="GitHub pull requests" src="https://camo.githubusercontent.com/38927ea08c9744eae34f8b897efe9fb6b44b9b88/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f74686566616c6c656e6d6572632f6769742d7265706f2d676973743f636f6c6f723d303038386666"&gt;
    &lt;/a&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;a href="https://git-repo-gist.herokuapp.com/framed/thefallenmerc/git-repo-gist/master/app.js" rel="nofollow"&gt;View Demo&lt;/a&gt;
    ·
    &lt;a href="https://github.com/thefallenmerc/git-repo-gist/issues"&gt;Report Bug&lt;/a&gt;
    ·
    &lt;a href="https://github.com/thefallenmerc/git-repo-gist/issues"&gt;Request Feature&lt;/a&gt;
  &lt;/p&gt;
&lt;h1&gt;
Index&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/thefallenmerc/git-repo-gist/master/readme.md/#github-stats-card"&gt;Github Repo Gist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/thefallenmerc/git-repo-gist/master/readme.md/#how-to-use-it"&gt;How to use it&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/thefallenmerc/git-repo-gist/master/readme.md/#customization"&gt;Customization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/thefallenmerc/git-repo-gist/master/readme.md/#features"&gt;Features&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Github Repo Gist&lt;/h3&gt;
&lt;p&gt;Github provides you with the functionality to make and embed a gist anywhere on the internet, but there's something missing, what if we want to share a gist of code from existing repo without the need of creating a new gist for it?&lt;/p&gt;
&lt;p&gt;This is where this code comes in.&lt;/p&gt;
&lt;h3&gt;
How to use it&lt;/h3&gt;
&lt;p&gt;There are few simple steps to get gist out of code -&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get the &lt;code&gt;uri&lt;/code&gt; to the &lt;code&gt;raw&lt;/code&gt; file, for eg &lt;code&gt;https://raw.githubusercontent.com/thefallenmerc/git-repo-gist/master/app.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;extract the part starting from your username till end, (everything after &lt;code&gt;https://raw.githubusercontent.com/&lt;/code&gt;), we get &lt;code&gt;thefallenmerc/git-repo-gist/master/app.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Append this to our base url with any of the option available in between…&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/thefallenmerc/git-repo-gist"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>github</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Internationalization in React without any external package</title>
      <dc:creator>Shubham Singh Chahar</dc:creator>
      <pubDate>Sun, 19 Apr 2020 06:05:23 +0000</pubDate>
      <link>https://dev.to/shubhamsinghchahar/internationalization-in-react-without-any-external-package-5880</link>
      <guid>https://dev.to/shubhamsinghchahar/internationalization-in-react-without-any-external-package-5880</guid>
      <description>&lt;p&gt;Internationalization is the process of making an application multi-locale, an application that supports more than one language.&lt;/p&gt;

&lt;p&gt;There is already a popular package for it &lt;code&gt;react-intl&lt;/code&gt;. But to understand the concept and make our grasp on React as well as javascript, we will try to implement it without any external library.&lt;/p&gt;

&lt;p&gt;To follow this tutorial, you need to have knowledge of some of the concepts like &lt;code&gt;Higher Order Function&lt;/code&gt; and &lt;code&gt;ContextAPI&lt;/code&gt;. If you struggle there, I suggest you to get a hold on them for better understanding, or you can just follow this tutorial, we will get things working anyway.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://stackblitz.com/edit/react-locale-imlementation?embed=1&amp;amp;view=preview&amp;amp;" width="100%" height="500"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Localization based on JSON translation files&lt;/li&gt;
&lt;li&gt;Persistant choice&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our solution will be easy, simple and efficient. So lets dive right into it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project overview
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MvLOk51G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zjl1mhx0jn70b7ijrevc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MvLOk51G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zjl1mhx0jn70b7ijrevc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;components - this directory contains all the components for our app&lt;/li&gt;
&lt;li&gt;_contexts - this directory contains all the contexts related logic&lt;/li&gt;
&lt;li&gt;_locales - this directory contains all the JSON translation files&lt;/li&gt;
&lt;li&gt;index.js - the starting point of our app&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's try to understand the workflow here, we will create a Locale context that will manage the locale of our app and wrap the app in it.&lt;br&gt;
We will then use a special function that is provided by the context wherever we will feel a need to make the content multilingual.&lt;/p&gt;

&lt;p&gt;We will pass the string to be handled in the special function which will return the translated string.&lt;/p&gt;

&lt;p&gt;That's it.&lt;/p&gt;
&lt;h4&gt;
  
  
  Locale
&lt;/h4&gt;

&lt;p&gt;Let's have a look at the translation json files at first, the content of &lt;code&gt;hi.locale.json&lt;/code&gt; is -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hello"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"नमस्कार"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;as you can see, this file contains only one translation, i.e. for hello. so whenever our app's current mode is set to language &lt;code&gt;Hindi&lt;/code&gt;, all hello wrapped in the special function would be turned to &lt;code&gt;नमस्कार&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To add more translations we just have to add more key-value pairs.&lt;/p&gt;

&lt;h4&gt;
  
  
  Context
&lt;/h4&gt;

&lt;p&gt;This directory contains the logic for contexts, it contains only one file &lt;code&gt;locale.context.js&lt;/code&gt;, let's have a look at its content.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;LocaleContext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;withLocale&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;LocaleContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Consumer&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="si"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="err"&gt;{&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;props&lt;/span&gt;&lt;span class="err"&gt;}&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;LocaleContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Consumer&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;withLocale&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This file contains two exports, first one is the &lt;code&gt;LocaleContext&lt;/code&gt; and the second one is a &lt;code&gt;Higher Order Component&lt;/code&gt; that wraps any given component in a &lt;code&gt;LocaleContext.Consumer&lt;/code&gt;, so that we can use a special &lt;code&gt;handle&lt;/code&gt; function to handle the string conversion.&lt;/p&gt;

&lt;h4&gt;
  
  
  Components
&lt;/h4&gt;

&lt;p&gt;This directory contains all the components (only two) that are used in our app.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Home Component&lt;/li&gt;
&lt;li&gt;Locale Component&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Locale Component
&lt;/h4&gt;

&lt;p&gt;Let's start with the locale component -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;LocaleContext&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../_contexts/locale.context&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;en&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../_locales/en.locale&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;hi&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../_locales/hi.locale&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ta&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../_locales/ta.locale&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;translations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;en&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;hi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;ta&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Locale&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// get saved langcode from localstorage&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;langCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;langCode&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// validate the langcode with available languages&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;translations&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;langCode&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;langCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;current&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;langCode&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;translations&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;()]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;LocaleContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt;
        &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;current&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handle&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className=&lt;/span&gt;&lt;span class="s2"&gt;"LocaleSelector"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;select&lt;/span&gt;
            &lt;span class="na"&gt;defaultValue=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
            &lt;span class="na"&gt;onChange=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;langCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
              &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;current&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;langCode&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;langCode&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;langCode&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
              &lt;span class="p"&gt;});&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
          &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;translations&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
              &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
              &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;select&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;LocaleContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Locale&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Let's start understanding what is happening here, in this component, we start off by importing react, and then the locale-files.&lt;/p&gt;

&lt;p&gt;Next, we create a translations object, this object is has a key role in whole process, the keys in this object are lang code and values are the relative locale JSONs, which now are loaded as object themselves.&lt;/p&gt;

&lt;p&gt;Next is the locale component itself, in the constructor, we are loading last saved preference from &lt;code&gt;localstorage&lt;/code&gt;, if none found we set it as &lt;code&gt;en&lt;/code&gt; for default.&lt;/p&gt;

&lt;p&gt;The next line is a validation check, incase some language is set to current from &lt;code&gt;localstorage&lt;/code&gt;, for eg &lt;code&gt;hindi&lt;/code&gt;, but our application now is not supporting &lt;code&gt;hindi&lt;/code&gt;, this check just makes "en" as current &lt;code&gt;langCode&lt;/code&gt; incase the last language choice in now invalid.&lt;/p&gt;

&lt;p&gt;After constructor, there is a method defined named &lt;code&gt;handle&lt;/code&gt;, this is the special function that we were talking about, the &lt;code&gt;handle&lt;/code&gt; takes in a string, finds if the translation of the string is available in currently selected language and then return the translation, or the string itself if the translation is not available.&lt;/p&gt;

&lt;p&gt;Next comes that &lt;code&gt;render&lt;/code&gt; method, we initialize the &lt;code&gt;LocaleContext.Provider&lt;/code&gt; and pass it an object as value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;current&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="nx"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handle&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The current key holds the currently selected langcode.&lt;br&gt;&lt;br&gt;
The handle method is also passed so that any consumer can use it to translate.&lt;/p&gt;

&lt;p&gt;Next we have the locale select drop down -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;LocaleSelector&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;select&lt;/span&gt;
            &lt;span class="na"&gt;defaultValue=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
            &lt;span class="na"&gt;onChange=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;langCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
              &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;current&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;langCode&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;langCode&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;langCode&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
              &lt;span class="p"&gt;});&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
          &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;translations&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
              &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt; &lt;span class="na"&gt;key=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
              &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;option&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;select&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="err"&gt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The options for &lt;code&gt;select&lt;/code&gt; tag are populated by the translations object, it also has an &lt;code&gt;onChange&lt;/code&gt; handler which sets the currently selected &lt;code&gt;langCode&lt;/code&gt; to state and also updates its value in &lt;code&gt;localstorage&lt;/code&gt; for latter use.&lt;/p&gt;

&lt;p&gt;Just below it is -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This line of code is necessary to render the children of our &lt;code&gt;LocaleProvider&lt;/code&gt;, we will see what this is about when we react &lt;code&gt;index.js&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  HomeComponent
&lt;/h4&gt;

&lt;p&gt;This is the actual component that will make the use of our internationalization -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;withLocale&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../_contexts/locale.context&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;HomeComponent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;lang&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className=&lt;/span&gt;&lt;span class="s2"&gt;"Home"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Home&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;withLocale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HomeComponent&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Here, we import React, then the &lt;code&gt;Higher Order Component&lt;/code&gt; &lt;code&gt;withLocale&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We declare &lt;code&gt;HomeComponent&lt;/code&gt; with takes in &lt;code&gt;prop&lt;/code&gt; containing &lt;code&gt;lang&lt;/code&gt; object, this &lt;code&gt;lang&lt;/code&gt; object is the value of &lt;code&gt;LocaleContext&lt;/code&gt; that will be provided by &lt;code&gt;withLocale&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;Inside &lt;code&gt;HomeComponent&lt;/code&gt; we are using the special &lt;code&gt;handle&lt;/code&gt; function with handles the translation and passing it &lt;code&gt;hello&lt;/code&gt;, remember &lt;code&gt;hello&lt;/code&gt; is a key in our localization files.&lt;/p&gt;

&lt;p&gt;at the last line we are export &lt;code&gt;HomeComponent&lt;/code&gt; wrapped in &lt;code&gt;withLocale&lt;/code&gt;, any component that would like to access the &lt;code&gt;handle&lt;/code&gt; function must be wrapped in &lt;code&gt;withLocale&lt;/code&gt; or the &lt;code&gt;LocaleContext.Consumer&lt;/code&gt; itself.&lt;/p&gt;

&lt;h4&gt;
  
  
  index.js
&lt;/h4&gt;

&lt;p&gt;The index.js is the files that joins all functionality together.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;render&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./style.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Locale&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./_components/locale.component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Home&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./_components/home.component&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className=&lt;/span&gt;&lt;span class="s2"&gt;"App"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Locale&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Home&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Locale&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;,&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We initialize the app in here, Provide &lt;code&gt;Locale&lt;/code&gt; component with child &lt;code&gt;Home&lt;/code&gt;, &lt;code&gt;Home&lt;/code&gt; will replace &lt;code&gt;{this.props.children}&lt;/code&gt; in &lt;code&gt;Locale&lt;/code&gt; component.&lt;/p&gt;

&lt;p&gt;And that's pretty much it.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://stackblitz.com/edit/react-locale-imlementation?embed=1&amp;amp;view=preview&amp;amp;" width="100%" height="500"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A Fast deploying Realtime Firebase + React-based blog</title>
      <dc:creator>Shubham Singh Chahar</dc:creator>
      <pubDate>Thu, 16 Apr 2020 14:18:42 +0000</pubDate>
      <link>https://dev.to/shubhamsinghchahar/a-fast-deploying-realtime-firebase-react-based-blog-3nh5</link>
      <guid>https://dev.to/shubhamsinghchahar/a-fast-deploying-realtime-firebase-react-based-blog-3nh5</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1486312338219-ce68d2c6f44d%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1952%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1486312338219-ce68d2c6f44d%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D1952%26q%3D80"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  The Problem
&lt;/h3&gt;




&lt;p&gt;TLDR;&lt;/p&gt;

&lt;p&gt;Hey guys,&lt;br&gt;&lt;br&gt;
Being a full-stack developer is a tedious task, won't you agree?&lt;/p&gt;

&lt;p&gt;For every web-app I make, I have got to manage the frontend as well as the backend.  &lt;/p&gt;

&lt;p&gt;I mean come on, this much work? The mobile app guys don't have to deal with two different&lt;br&gt;
projects at a time,&lt;br&gt;&lt;br&gt;
let alone two different technologies. Lucky folks.&lt;/p&gt;

&lt;p&gt;But what do they say, with great power comes great responsibility. Many times we are just confused even on things like what tech stack to use.&lt;/p&gt;

&lt;p&gt;I was also tangled in questions like this when I started my search for a more efficient and sustainable development method.&lt;br&gt;&lt;br&gt;
That's when I was reminded of Firebase by &lt;a href="https://github.com/thealphamerc" rel="noopener noreferrer"&gt;Sonu Sharma&lt;/a&gt;, of course, why did I not think of it.&lt;/p&gt;

&lt;p&gt;I went through the documentation and learned the basics, got my hands on a few practice projects before I got confident about it.&lt;/p&gt;

&lt;p&gt;So here I am with a solution to all of our problems, Over the last few weeks, I have been investing quite a few hours in it.&lt;/p&gt;


&lt;h3&gt;
  
  
  The Solution
&lt;/h3&gt;



&lt;p&gt;Comes in the &lt;strong&gt;TFM-BLOG&lt;/strong&gt;, &lt;/p&gt;

&lt;p&gt;It removes the overhead of server handling and APIs from you.&lt;br&gt;
Configuring it is pretty easy and straight forward too.&lt;/p&gt;

&lt;p&gt;Almost no programming experience is required. Everything is handled by the developers already. Just plug and play.&lt;/p&gt;

&lt;p&gt;TFM-BLOG aims to be a simple, minimalistic, yet powerful blogging platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Estimated deployment time&lt;/strong&gt; - 10 Minutes&lt;/p&gt;


&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;



&lt;ol&gt;
&lt;li&gt;Firebase Authentication.&lt;/li&gt;
&lt;li&gt;Serverless.&lt;/li&gt;
&lt;li&gt;Markdown based.&lt;/li&gt;
&lt;li&gt;Firestore for database.&lt;/li&gt;
&lt;li&gt;Cloudinary for CDN (Optional).&lt;/li&gt;
&lt;li&gt;Realtime updates.&lt;/li&gt;
&lt;li&gt;Minimal sleek UI.&lt;/li&gt;
&lt;/ol&gt;


&lt;h3&gt;
  
  
  The Steps
&lt;/h3&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Visit &lt;a href="https://github.com/thefallenmerc/tfm-blog" rel="noopener noreferrer"&gt;The Github repo&lt;/a&gt; to use the template.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585847573%2Ftfm-blog-step-1_zzbknz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585847573%2Ftfm-blog-step-1_zzbknz.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Customize your repository&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585849823%2Ftfm-blog-step-2_hwyyak.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585849823%2Ftfm-blog-step-2_hwyyak.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Clone the newly created repo to your local machine&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585849991%2Ftfm-blog-step-3_ekump8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585849991%2Ftfm-blog-step-3_ekump8.png"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585850289%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-3a_hfjlsb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585850289%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-3a_hfjlsb.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;npm install&lt;/code&gt; on the newly created directory to install the npm dependencies. (&lt;strong&gt;This step needs npm installed on your system&lt;/strong&gt;, please refer to &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;this link&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;look for a file .env.sample in the created directory and make two duplicates of it namely, .env.development and .env.production.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585849027%2FImage_006_yshrqk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585849027%2FImage_006_yshrqk.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now head on to the &lt;a href="https://console.firebase.google.com/" rel="noopener noreferrer"&gt;firebase console&lt;/a&gt;, (&lt;strong&gt;hope you are signed in&lt;/strong&gt;) and create a new project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585851605%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-4_sl7f4w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585851605%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-4_sl7f4w.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Insert the project name, and click on continue, click continue new on the following screen as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585851898%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-5_hypize.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585851898%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-5_hypize.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select analytics account if opted for google analytics on the previous screen and click continue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585852039%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-6_wsfnt6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585852039%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-6_wsfnt6.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It will take a few seconds to set up all the things necessary, click on Continue when ready.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Once you are at firebase dashboard of the newly created project, click on authentication tab in sidebar (can change with newer firebase UI updates) and then click on &lt;code&gt;Set up sign-in methods&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585852655%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-10_wwev3q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585852655%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-10_wwev3q.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On the next screen, click on pencil icon next to the Email, and then click on save after enabling the relative checkboxes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585852850%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-11a_ea4xid.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585852850%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-11a_ea4xid.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853006%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-11b_xr9htx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853006%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-11b_xr9htx.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Switch to the Users tab, click on add, fill in the credentials and click on add user to save the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853298%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-12_y0jkj4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853298%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-12_y0jkj4.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make a note of the new user's uid as we will need it to fetch the list of blog posts by us.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853449%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-13_sla1ge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853449%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-13_sla1ge.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now time to get the configuration to connect firebase to our blog, click on the cog icon in the sidebar and head on to settings&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853611%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-14_hiembe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853611%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-14_hiembe.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click on the code icon (its the icon for web-app) and it will redirect you to a page where you will add a new web app to firebase.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853763%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-15_dd19yy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853763%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-15_dd19yy.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fill in the form, add a nickname, check the also set up firebase hosting (this is crucial), click on register app, click on next, we don't need the scripts right now, also click next until the setup is complete.&lt;br&gt;&lt;br&gt;
I will guide you through the remaining steps, so you don't have to worry about missing anything.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853903%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-16_vt9o7j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585853903%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-16_vt9o7j.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now this step includes integrating firebase in the that we created previously back in step 3. Go to the repo directory, open up bash or cmd and run the following command, it installs firebase-tools globally, so you don't have to run it next time you are creating an app following this tutorial -&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    npm install -g firebase-tools
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Once done, run the following and follow steps to log in to firebase, most probably it would be web-based authentication -&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    firebase login
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;After the login is successful, run the following command -&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    firebase init
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Type &lt;code&gt;y&lt;/code&gt; when asked to confirm&lt;br&gt;
When asked &lt;code&gt;Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confirm your choices.&lt;/code&gt;&lt;br&gt;
use up/down arrow to navigate, space to select &lt;code&gt;Hosting&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585854732%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-19_rifvzn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585854732%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-19_rifvzn.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the next prompt select 'Use an existing project', it will then prompt you with all the available project, select your desired (in our case it is 'my-awesome-tfm-blog (my-awesome-tfm-blog)')&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now it will prompt what directory to use as public, &lt;strong&gt;it is the build directory of your react app by default&lt;/strong&gt;, so input build and press enter.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now it asks whether our app is SPA, which it most definitely is, so press 'y' and followed by enter.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Firebase is now initialized in our project. Time to configure the APP_KEYS and other credentials.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Remember we made two files '.env.development' and '.env.development' in step 5? The development file is used in the development environment and production in production as the name suggests, we will now populate data in these files, mostly you will use the same credentials in both.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Head over to console once again you will still be on the settings page, if not, click on cog icon in the sidebar and then go to project settings. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll down to the bottom, your app will now be listed there.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Under the section 'Firebase SDK snippet', click on the radio that says config and you will snippet of JS code - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585855550%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-27_wxtcsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585855550%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-27_wxtcsh.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Switch back to local and open .env.development in any text editor, what you will see is an env file with various variables that have blank value prepended with 'REACT_APP'&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585855748%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-28_pkkfih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585855748%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-28_pkkfih.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill all the values from the firebase console to relevant variable in the env file, the string can be surrounded in double-quotes, also do not add a comma at the end.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After filling most of the values you might notice that REACT_APP_NAME and REACT_APP_DEFAULT_USER_ID are two value you cannot find relevant data for,&lt;br&gt;&lt;br&gt;
Let's fill them up too...&lt;br&gt;&lt;br&gt;
&lt;strong&gt;REACT_APP_NAME&lt;/strong&gt; will take the value that you want to be displayed on the navbar of your blog.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;REACT_APP_DEFAULT_USER_ID&lt;/strong&gt; will take the uid value of the user that we created in step 3, to get the uid, go to the console, select authentication and then users tab, from there just copy the uid and insert it in the app. Make sure your both env files look like this - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585856237%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-30_jv96rk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585856237%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-30_jv96rk.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Time to build and deploy the app. Run the following command on the terminal to build the project&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    npm run build --prod
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Run the following command to deploy the project&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    firebase deploy
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Both of these commands will result in the following output, stating that the deployment is successful! Cheers!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585857011%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-32_mbvxcz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585857011%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-32_mbvxcz.png"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Before heading over to the URL provided as the output of the last step, for me it is &lt;a href="https://my-awesome-tfm-blog.firebaseapp.com" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://my-awesome-tfm-blog.firebaseapp.com" rel="noopener noreferrer"&gt;https://my-awesome-tfm-blog.firebaseapp.com&lt;/a&gt;, let us complete the last task.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Let us set up the realtime database 'firestore' provided by firebase. Head to the console, select 'database' from the sidebar and click on create database button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585857450%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-34_dys34i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585857450%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-34_dys34i.png"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;It will prompt you to set up, rules, for the sake of simplicity, let us choose test mode, for now, we will learn more about rules in another tutorial.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585857594%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-35_ofz9q8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Ftfm-cdn%2Fimage%2Fupload%2Fv1585857594%2FTFM_BLOG_TUTORIAL%2Ftfm-blog-step-35_ofz9q8.png"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;On the next screen select any of the locations you prefer and finish the setup. Firestore is now configured.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Now we can head over to the URL that we got in step 33 after deploying the app. For me, it was &lt;a href="https://my-awesome-tfm-blog.firebaseapp.com" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://my-awesome-tfm-blog.firebaseapp.com" rel="noopener noreferrer"&gt;https://my-awesome-tfm-blog.firebaseapp.com&lt;/a&gt;, we can see the deployed app now, but it feels empty.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;To know how to create a blog post and about other features of the blog head over to &lt;a href="https://dev.to/tfm-blog-getting-started"&gt;TFM-BLOG Getting Started&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>react</category>
      <category>firebase</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Making Speech to text converter using the HTML5 WebSpeech API</title>
      <dc:creator>Shubham Singh Chahar</dc:creator>
      <pubDate>Wed, 15 Apr 2020 16:50:43 +0000</pubDate>
      <link>https://dev.to/shubhamsinghchahar/making-text-to-speech-converter-using-the-html5-webspeech-api-291e</link>
      <guid>https://dev.to/shubhamsinghchahar/making-text-to-speech-converter-using-the-html5-webspeech-api-291e</guid>
      <description>&lt;p&gt;Hello guys,&lt;/p&gt;

&lt;p&gt;So I was working on this project that is a web-port of a Native App.&lt;br&gt;
Basically the client wants to provide the user with an audio clip that is played for him with the text underneath it.&lt;/p&gt;

&lt;p&gt;Then the user has to repeat the sentence, our app will output what the user said on the screen so that the user can evaluate his grip over the language.&lt;/p&gt;

&lt;p&gt;To perform this task, I had to do some research upon which I found out that there is actually a &lt;strong&gt;Web Speech API&lt;/strong&gt; support available for browsers.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Web Speech API&lt;/strong&gt;, is currently only supported by the chromium-based browser like Chrome version 25 and up, also it is currently only available in nightly builds of Mozilla Firefox. This is due to the fact that &lt;strong&gt;Web Speech API&lt;/strong&gt; currently utilizes Google's text to speech tech.&lt;/p&gt;

&lt;p&gt;Here is the basic example of how you can use &lt;strong&gt;Web Speech API&lt;/strong&gt; yourself.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;This little piece of code will start the listener, the browser might ask for &lt;code&gt;microphone&lt;/code&gt; request, you have to accept it.&lt;/p&gt;

&lt;p&gt;Then just speak anything and when you are done. You will see some output on the console.&lt;/p&gt;

&lt;p&gt;So let me break it down for you -&lt;/p&gt;

&lt;p&gt;Tag #1 initializes &lt;code&gt;webkitSpeechRecognition&lt;/code&gt;, which is what makes the Text-To-Speech come to life.&lt;/p&gt;

&lt;p&gt;Tag #2 attaches an &lt;code&gt;event handler&lt;/code&gt; for when the process of recognition is complete and provides us with a &lt;code&gt;SpeechRecognitionEvent&lt;/code&gt; object.&lt;/p&gt;

&lt;p&gt;Tag #3 starts the speech recognition engine, the browser will now start listening to you.&lt;/p&gt;

&lt;p&gt;The response object can be used to fetch the recognized text. If you navigate it, you will find that &lt;code&gt;response.results&lt;/code&gt; contains a list of all the results that were a similar match.&lt;/p&gt;

&lt;p&gt;You can fetch the return result from &lt;code&gt;response.results[0][0].transcript&lt;/code&gt; and the degree of accuracy by &lt;code&gt;response.results[0][0].confidence&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Also you can use variety of handler callbacks like &lt;code&gt;speechstart&lt;/code&gt;, &lt;code&gt;speechend&lt;/code&gt; but more on that later.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/shubhamsinghchahar/embed/vYNLxzW?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;If the pen doesn't work here, please visit the link given below.&lt;/p&gt;

&lt;p class="codepen"&gt;
  &lt;span&gt;See the Pen &lt;a href="https://codepen.io/shubhamsinghchahar/pen/vYNLxzW"&gt;
  Make text to speech converter ssing the HTML5 WebSpeech API&lt;/a&gt; by Shubham Singh Chahar (&lt;a href="https://codepen.io/shubhamsinghchahar"&gt;@shubhamsinghchahar&lt;/a&gt;)
  on &lt;a href="https://codepen.io"&gt;CodePen&lt;/a&gt;.&lt;/span&gt;
&lt;/p&gt;

</description>
      <category>html</category>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
