<?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: Adam Kiss</title>
    <description>The latest articles on DEV Community by Adam Kiss (@adamkss).</description>
    <link>https://dev.to/adamkss</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%2F255433%2F008406d0-473a-48b5-addb-80cac35c3383.jpg</url>
      <title>DEV Community: Adam Kiss</title>
      <link>https://dev.to/adamkss</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adamkss"/>
    <language>en</language>
    <item>
      <title>It’s Okay to be An Average Developer</title>
      <dc:creator>Adam Kiss</dc:creator>
      <pubDate>Sun, 13 Dec 2020 16:26:12 +0000</pubDate>
      <link>https://dev.to/adamkss/it-s-okay-to-be-an-average-developer-41ik</link>
      <guid>https://dev.to/adamkss/it-s-okay-to-be-an-average-developer-41ik</guid>
      <description>&lt;p&gt;You &lt;strong&gt;do not&lt;/strong&gt; have to code 13 hours a day.&lt;/p&gt;

&lt;p&gt;You &lt;strong&gt;do not&lt;/strong&gt; have to be up to date with the latest libraries and frameworks.&lt;/p&gt;

&lt;p&gt;You &lt;strong&gt;do not&lt;/strong&gt; have to write top libraries.&lt;/p&gt;

&lt;p&gt;You &lt;strong&gt;do not&lt;/strong&gt; have to build 3 side projects in parallel.&lt;/p&gt;

&lt;p&gt;You &lt;strong&gt;do not&lt;/strong&gt; have to be accepted at Facebook, Amazon, Google or your local hyped company.&lt;/p&gt;

&lt;p&gt;You &lt;strong&gt;do not&lt;/strong&gt; have to be a specialist in Frontend, Backend, Machine Learning, Augmented Reality whilst knowing your way through AWS, and oh, let’s not forget, also work on your Flutter and React Native side projects in the evenings!&lt;/p&gt;

&lt;p&gt;You don’t have to, because…&lt;/p&gt;

&lt;h1&gt;
  
  
  Being Average may just be The Best for You
&lt;/h1&gt;

&lt;p&gt;Employers are mostly searching for developers they can trust. For developers that can get their assigned tasks done in their own pace. For &lt;em&gt;average&lt;/em&gt; developers.&lt;/p&gt;

&lt;p&gt;Remember, there are &lt;em&gt;very few&lt;/em&gt; people that are truly exceptional. These developers, well, you can see from a thousand miles. They quickly get up the ladder and are put into tech lead roles. A lot of responsibility. Stress. Long workings hours. Would you even want that if that’s not what you were born for?&lt;/p&gt;

&lt;p&gt;The vast majority of us are average. We get our tasks done. We solve problems. And that, in most cases, &lt;strong&gt;is perfectly fine&lt;/strong&gt;!&lt;/p&gt;

&lt;h1&gt;
  
  
  About Guilt
&lt;/h1&gt;

&lt;p&gt;We all get that &lt;em&gt;nasty&lt;/em&gt; feeling sometimes! Am I doing enough? Am I learning, building, hustling enough? Am I enough?&lt;/p&gt;

&lt;p&gt;Do &lt;strong&gt;not&lt;/strong&gt; feel guilty that you did not work on your side project on Saturday evening!&lt;/p&gt;

&lt;p&gt;Do &lt;strong&gt;not&lt;/strong&gt; feel guilty that you haven’t had the time to experiment with the latest frameworks!&lt;/p&gt;

&lt;p&gt;It’s fine!&lt;/p&gt;

&lt;p&gt;As long as you get your tasks done at your own pace, you should feel pretty darn good about yourself!&lt;/p&gt;

&lt;p&gt;As long as you are conscious enough to know that you will always need to learn new things on some occasions, do &lt;strong&gt;not&lt;/strong&gt; let the complicated and quickly changing world of programming overwhelm you.&lt;/p&gt;

&lt;h1&gt;
  
  
  Progress &amp;amp; Opportunities
&lt;/h1&gt;

&lt;p&gt;Take everything in at your own pace.&lt;/p&gt;

&lt;p&gt;Learn, experiment and build in your free time &lt;strong&gt;only&lt;/strong&gt; when you feel like it.&lt;/p&gt;

&lt;p&gt;Do &lt;strong&gt;not&lt;/strong&gt; do it out of obligation, as this only puts more unnecessary stress on you and won’t get you anywhere.&lt;/p&gt;

&lt;p&gt;Remember, most of the jobs are filled by average developers. You, me, the average Joe.&lt;/p&gt;

&lt;p&gt;Learn, experiment and build only out of &lt;strong&gt;fun and passion!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you liked this short opinion post, feel free to follow me and my newsletter at &lt;a href="https://adamkiss.net"&gt;https://adamkiss.net&lt;/a&gt;. I would love that!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>motivation</category>
      <category>career</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Internationalize your React App In 5 Easy Steps With React Intl</title>
      <dc:creator>Adam Kiss</dc:creator>
      <pubDate>Sun, 13 Dec 2020 16:11:34 +0000</pubDate>
      <link>https://dev.to/adamkss/internationalize-your-react-app-in-5-easy-steps-with-react-intl-3i3b</link>
      <guid>https://dev.to/adamkss/internationalize-your-react-app-in-5-easy-steps-with-react-intl-3i3b</guid>
      <description>&lt;h1&gt;
  
  
  What is Internationalization?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Internationalization&lt;/strong&gt; is the term used for making a website suitable for multiple locales (i.e. one or more places and/or languages).&lt;/p&gt;

&lt;p&gt;Internationalization is oftentimes shortened to i18n as it starts with an “i”, ends with an “n” and there are 18 other characters in between. Developers just love their abbreviations, don’t they?&lt;/p&gt;

&lt;p&gt;A good internationalization framework should provide a decent DX (developer experience) without taking up a lot of implementation time.&lt;/p&gt;

&lt;h1&gt;
  
  
  React Intl
&lt;/h1&gt;

&lt;p&gt;The library this article presents is called &lt;strong&gt;React Intl&lt;/strong&gt;. With more than 800,000 monthly downloads it’s one of the most used tools for internationalization in the world of React.&lt;/p&gt;

&lt;p&gt;React Intl can do a lot more than just choosing messages/strings based on the locale. It can also format numbers and dates based on it! &lt;br&gt;
In this article, however, only the messages aspect of it is covered as this is what most people are mainly looking for.&lt;/p&gt;

&lt;p&gt;React Intl will now be presented in the context of a React app bootstrapped with create-react-app, using English and German as demo languages.&lt;/p&gt;

&lt;p&gt;The repository with the working code can be found here: &lt;a href="https://github.com/adamkss/react-intl-demo" rel="noopener noreferrer"&gt;https://github.com/adamkss/react-intl-demo&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Adding the dependencies
&lt;/h2&gt;

&lt;p&gt;First of all, React Intl has to be added as a dependency by running: &lt;code&gt;yarn add react-intl&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We also need one more dependency to add, and that is &lt;code&gt;extract-react-intl-messages&lt;/code&gt;. This development depndency will be used to extract the internationalized messages into their own language files. Thus, run: &lt;code&gt;yarn add -D extract-react-intl-messages&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In order for &lt;code&gt;extract-react-intl-messages&lt;/code&gt; to work, make sure to also create a &lt;code&gt;.babelrc&lt;/code&gt; file in the root of your project with the following content:&lt;/p&gt;


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


&lt;h2&gt;
  
  
  2. Creating the locale specific files
&lt;/h2&gt;

&lt;p&gt;Each locale to be supported needs to have its own file which stores the localised messages in JSON format.&lt;/p&gt;

&lt;p&gt;Create a new folder called &lt;code&gt;translations&lt;/code&gt;, and create &lt;code&gt;en.json&lt;/code&gt; and &lt;code&gt;de.json&lt;/code&gt;. Both should be, for now, empty:&lt;/p&gt;


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



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


&lt;p&gt;Let’s also create an &lt;code&gt;index.js&lt;/code&gt; in the translations folder which will export the translations themselves:&lt;/p&gt;


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


&lt;h2&gt;
  
  
  3. Wrap your React tree with React Intl’s provider
&lt;/h2&gt;

&lt;p&gt;The React tree must be wrapped withr &lt;code&gt;react-intl&lt;/code&gt;’s &lt;code&gt;IntlProvider&lt;/code&gt; so the internationalized messages become accessible in each and every component.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;IntlProvider&lt;/code&gt; expects 2 important props: the actual &lt;code&gt;locale&lt;/code&gt; and the internationalized messages selected by the locale.&lt;/p&gt;


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


&lt;p&gt;In the above example the locale is hardcoded. In general, you should either check the browser’s default language (via the navigator object: &lt;code&gt;navigator.language&lt;/code&gt;), geo locate the user or let them simply select from a language list.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Start defining the messages
&lt;/h2&gt;

&lt;p&gt;Each internationalized message should have an ID and a default value. Defining a default value is not mandatory, but it’s good if you start building your webpage in one language.&lt;/p&gt;

&lt;p&gt;Defining an internationalized message is as simple as using the &lt;code&gt;FormattedMessage&lt;/code&gt; component of &lt;code&gt;react-intl&lt;/code&gt;:&lt;/p&gt;


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


&lt;p&gt;Let’s define a simple React component which shows this greetings message and use it in the app:&lt;/p&gt;


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


&lt;p&gt;This would show us the default message:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flhmxc7nkhge9t048iv4w.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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flhmxc7nkhge9t048iv4w.png" alt="Screenshot 2020-12-13 at 13.01.41"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  5. Adding messages in another language
&lt;/h2&gt;

&lt;p&gt;As pointed out in the beginning of this article, all messages are stored in the language specific files (in this demo’s case &lt;code&gt;en.json&lt;/code&gt; and &lt;code&gt;de.json&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;We must use the development dependency we added (&lt;code&gt;extract-react-intl-messages&lt;/code&gt;) to fill these out with the keys (IDs) of our messages. For example, the &lt;code&gt;greetingsMessage&lt;/code&gt; we used above.&lt;/p&gt;

&lt;p&gt;For this we need to add a new script called &lt;code&gt;extract-intl&lt;/code&gt; to the &lt;code&gt;package.json&lt;/code&gt;'s scripts key right below the react-scripts:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;This script, &lt;code&gt;extract-intl&lt;/code&gt;, runs &lt;code&gt;extract-messages&lt;/code&gt; with a few arguments:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;-l&lt;/code&gt;: defines the available locales, in this demo en(universal English) and de(universal German)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-o&lt;/code&gt;: defines the location of the internationalized JSONs (&lt;code&gt;de.json&lt;/code&gt; and &lt;code&gt;en.json&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-d&lt;/code&gt;: defines the default locale, in our demo it is set to English. Based on this argument, &lt;code&gt;extract-messages&lt;/code&gt; copies the default messages we define in the code to the default locale’s JSON, in our case &lt;code&gt;en.json&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After running this command via &lt;code&gt;yarn extract-intl&lt;/code&gt;, take a look at the two JSON files:&lt;/p&gt;


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



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


&lt;p&gt;You can see that the default language’s localized file has been filled out with the default messages present in the code, whilst the other language file only has the keys. The values are now ready to be defined there as well!&lt;/p&gt;

&lt;p&gt;The German version of &lt;code&gt;greetingsMessage&lt;/code&gt; can be manually set by modifying &lt;code&gt;de.json&lt;/code&gt;:&lt;/p&gt;


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


&lt;p&gt;Now, to try it out, the German locale (&lt;code&gt;de&lt;/code&gt;) needs to be passed to &lt;code&gt;IntlProvider&lt;/code&gt;, which in turn will use all the German messages defined in &lt;code&gt;de.json&lt;/code&gt;:&lt;/p&gt;


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


&lt;p&gt;By doing this modification (swapping the locale passed to &lt;code&gt;react-intl&lt;/code&gt;), we now get the German message, without having needed to actually touch the code of the component:&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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi5lq18yeyktq8gosdak0.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%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi5lq18yeyktq8gosdak0.png" alt="Screenshot 2020-12-13 at 13.19.01"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great! Here is a summary of what needed to be done for internationalization:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Define the languages and language files&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;&amp;lt;FormattedMessage&amp;gt;&lt;/code&gt; component with the ID of the internationalized message to get the message based on the currently selected locale&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;yarn extract-intl&lt;/code&gt; to fill out your localisation JSONs with the existing message IDs. This also automatically inserts the default messages (defined in the code) into the default language’s JSON (set in the &lt;code&gt;extract-intl&lt;/code&gt; command)&lt;/li&gt;
&lt;li&gt;Fill out the rest of the JSONs (languages) with the correct values&lt;/li&gt;
&lt;li&gt;Change the locale passed to &lt;code&gt;IntlProvider&lt;/code&gt; based on your needs (by the user’s region, manually, by the browser’s language etc.) which automatically inserts the right messages in your app from the selected locale! &lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Other ways to access the messages
&lt;/h1&gt;

&lt;p&gt;Sometimes you cannot use the &lt;code&gt;&amp;lt;FormattedMessage&amp;gt;&lt;/code&gt; tag to get/define a message. Think about the situation where the title attribute has to be set on an HTML element.&lt;/p&gt;

&lt;p&gt;No worries! React Intl provides us with a hook and a HOC (higher order component you wrap your component with) that we can use to get access to the intl object (hook for functional components and a HOC, injectIntl, for class based components):&lt;/p&gt;


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



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


&lt;h1&gt;
  
  
  In closing
&lt;/h1&gt;

&lt;p&gt;React Intl provides a clean and simple way to internationalize your application 🌍. Feel free to give it a try!&lt;/p&gt;

&lt;p&gt;Thank you for reading this article all the way through, you rock!&lt;/p&gt;

&lt;p&gt;If you liked the content, I would love if you subscribed to my newsletter by visiting &lt;a href="https://adamkiss.net/" rel="noopener noreferrer"&gt;https://adamkiss.net/&lt;/a&gt;!&lt;/p&gt;

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