{"id":104,"date":"2019-09-25T06:46:32","date_gmt":"2019-09-25T06:46:32","guid":{"rendered":"https:\/\/docs.theironnetwork.org\/reactify\/?page_id=104"},"modified":"2019-10-10T08:21:16","modified_gmt":"2019-10-10T08:21:16","slug":"translate-the-appmulti-language-support","status":"publish","type":"page","link":"https:\/\/docs.theironnetwork.org\/reactify\/translate-the-appmulti-language-support\/","title":{"rendered":"Translate The App(Multi Language Support)"},"content":{"rendered":"\n<p><strong>Reactify<\/strong> support multilingual feature which helps you to build your app in your native language. Read the documentation below carefully and follow the given steps.<\/p>\n\n\n\n<h4 id=\"how-to-set-default-locale\">How To Set Default Locale<a href=\"#how-to-set-default-locale\"><\/a><\/h4>\n\n\n\n<p><strong>Reactify<\/strong> provide you the options to change the default locale of the template according to your native language. You can change the locale in the <code>AppConfig.js<\/code> file. You can find the <code>AppConfig.js<\/code> file in the <code>src-&gt;constants<\/code> folder.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/**<br> App Config File<br> *\/<br> const AppConfig = {<br>     \u2026,<br>     \/\/ set default locale <br>     locale: {<br>       languageId: 'english', \/\/ language id<br>       locale: 'en',          \/\/ locale code<br>       name: 'English',       \/\/ locale name<br>       icon: 'en'             \/\/ locale icon<br>     }<br> } <br> export default AppConfig;<\/pre>\n\n\n\n<p>You can find the details about the other supported languages &amp; their locales in the <code>src-&gt;reducers-&gt;settings.js<\/code> file under the <code>languages<\/code> array. Just select the locale in which you want to convert your template and pass this value in the above file. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">languages: [<br>     \/\/ English<br>     {<br>         languageId: 'english',<br>         locale: 'en',<br>         name: 'English',<br>         icon: 'en',<br>     },<br>     \u2026<br>     \/\/ Hungarian<br>     {<br>         languageId: 'hungarian',<br>         locale: 'hu',<br>         name: 'Hungarian',<br>         icon: 'hu',<br>     }<br> ]<\/pre>\n\n\n\n<p><strong>Reactify<\/strong> provides supports to 12 languages(built-in), They are: <strong>English<\/strong>, <strong>Chinese<\/strong>, <strong>Russian<\/strong>, <strong>Hebrew<\/strong>, <strong>French<\/strong>, <strong>Arabic<\/strong>, <strong>German<\/strong>, <strong>Spanish<\/strong>, <strong>Japanese<\/strong>, <strong>Korean<\/strong>, <strong>Italian<\/strong> and <strong>Hungarian.<\/strong> <\/p>\n\n\n\n<h4 id=\"how-to-add-a-new-locale\">How To Add A New Locale<a href=\"#how-to-add-a-new-locale\"><\/a><\/h4>\n\n\n\n<p>Here are the instructions to add a new locale in your app. We have taken an example of adding <strong>Greek<\/strong> language to the template.<\/p>\n\n\n\n<p><strong>Step 1:<\/strong> Create a file with the name of locale code inside the <code>src-&gt;lang-&gt;locales<\/code> directory and define the static strings which you want to translate into <strong>Greek<\/strong>, you can check the other locale files to check how strings are defined.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">module.exports = {<br>     \"sidebar.general\": \"\u03b3\u03b5\u03bd\u03b9\u03ba\u03cc\u03c2\",<br>     \"sidebar.horizontal\": \"\u03bf\u03c1\u03b9\u03b6\u03cc\u03bd\u03c4\u03b9\u03b1\"<br> }<\/pre>\n\n\n\n<p><strong>Step 2:<\/strong> Create a file with the name of locale code inside the <code>src-&gt;lang-&gt;entries<\/code> directory and follow the same steps as in other files e.g.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import appLocaleData from 'react-intl\/locale-data\/el';<br> import elMessages from '..\/locales\/el_EL';<br> const elLang = {<br>     messages: {<br>         \u2026elMessages<br>     },<br>     locale: 'el-EL',<br>     data: appLocaleData<br> };<br> export default elLang;<\/pre>\n\n\n\n<p><strong>Step 3:<\/strong> Open <code>index.js<\/code> file under the <code>src-&gt;lang<\/code> directory and follow the steps given below in the code block.index.js<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import appLocaleData from 'react-intl\/locale-data\/el';<br> import elMessages from '..\/locales\/el_EL';<br> const elLang = {<br>     messages: {<br>         \u2026elMessages<br>     },<br>     locale: 'el-EL',<br>     data: appLocaleData<br> };<br> export default elLang;<\/pre>\n\n\n\n<p><strong>Step 4:<\/strong> Now you need to add your locale inside the  <code>settings.js<\/code> file under the <code>src-&gt;reducers<\/code> directory.settings.js<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/**<br> * App Settings Reducers<br> *\/<br> ...<br> <br> \/**<br> * initial app settings<br> *\/<br>const INIT_STATE = {<br>  ...,<br>  languages: [<br>     {<br>         languageId: 'english',<br>         locale: 'en',<br>         name: 'English',<br>         icon: 'en',<br>      },<br>      ...<br>      \/\/ your new locale will goes here<br>      {<br>        languageId: 'greek',<br>        locale: 'el',<br>        name: 'Greek',<br>        icon: 'el',<br>      }<br>   ]<br>} <\/pre>\n\n\n\n<p>That&#8217;s it, Now you are done with adding a new locale to the template. If you want this newly added locale as your default then you can follow the steps given in the above section How To Set Default Locale to set it as your default locale.<\/p>\n<div class=\"pld-like-dislike-wrap pld-template-1\">\n    <div class=\"pld-like-wrap  pld-common-wrap\">\n    <a href=\"javascript:void(0);\" class=\"pld-like-trigger pld-like-dislike-trigger \" title=\"\" data-post-id=\"104\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-ip-check=\"0\" data-user-check=\"1\">\n                        <i class=\"fas fa-thumbs-up\"><\/i>\n                    <\/a>\n    <span class=\"pld-like-count-wrap pld-count-wrap\">1    <\/span>\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\n    <a href=\"javascript:void(0);\" class=\"pld-dislike-trigger pld-like-dislike-trigger \" title=\"\" data-post-id=\"104\" data-trigger-type=\"dislike\" data-ip-check=\"0\" data-restriction=\"cookie\" data-user-check=\"1\">\n                        <i class=\"fas fa-thumbs-down\"><\/i>\n                    <\/a>\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\n<\/div><\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Reactify support multilingual feature which helps you to build your app in your native language. Read the documentation below carefully and follow the given steps. How To Set Default Locale Reactify provide you the options to change the default locale of the template according to your native language. You can change the locale in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":12,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages\/104"}],"collection":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/comments?post=104"}],"version-history":[{"count":4,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages\/104\/revisions"}],"predecessor-version":[{"id":402,"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/pages\/104\/revisions\/402"}],"wp:attachment":[{"href":"https:\/\/docs.theironnetwork.org\/reactify\/wp-json\/wp\/v2\/media?parent=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}