{"id":193,"date":"2019-09-02T05:49:51","date_gmt":"2019-09-02T05:49:51","guid":{"rendered":"https:\/\/docs.theironnetwork.org\/vuely\/?page_id=193"},"modified":"2019-10-19T07:31:28","modified_gmt":"2019-10-19T07:31:28","slug":"translate-the-appmulti-language-support","status":"publish","type":"page","link":"https:\/\/docs.theironnetwork.org\/vuely\/translate-the-appmulti-language-support\/","title":{"rendered":"Translate The App(Multi Language Support)"},"content":{"rendered":"\n<p><strong>Vuely<\/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<h5>How To Set Default Locale<\/h5>\n\n\n\n<p><strong>Vuely<\/strong> provide you the options to change the default locale of the template according to your language. You can choose from the given table of the languages, to set any language as your default locale. Languages is a type of array used in the template and we are showing it here in the form of table.<\/p>\n\n\n\n<table class=\"wp-block-table ironthm-mb-2\"><tbody><tr><td><strong>Language<\/strong><\/td><td><strong>Assigned Number<\/strong><\/td><td><strong>Default Language Codes<\/strong><\/td><\/tr><tr><td>English<br><\/td><td>0<\/td><td>en<\/td><\/tr><tr><td>French<\/td><td>1<\/td><td>fr<\/td><\/tr><tr><td>Hebrew<\/td><td>2<\/td><td>he<\/td><\/tr><tr><td>Russian<\/td><td>3<\/td><td>ru<\/td><\/tr><tr><td>Arabic<\/td><td>4<\/td><td>ar<\/td><\/tr><tr><td>Chinese<\/td><td>5<\/td><td>cn<\/td><\/tr><tr><td>German<\/td><td>6<\/td><td>ge<\/td><\/tr><tr><td>Spanish<\/td><td>7<\/td><td>sp<\/td><\/tr><tr><td>Japanese<\/td><td>8<\/td><td>ja<\/td><\/tr><tr><td>Korean<\/td><td>9<\/td><td>ko<\/td><\/tr><tr><td>Italian<\/td><td>10<\/td><td>it<\/td><\/tr><tr><td>Hungarian<\/td><td>11<\/td><td>hu<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Go to the <code>src-&gt;store-&gt;modules-&gt;settings<\/code> directory and open <code>index.js<\/code> file. Search for the key <code>selectedLocale<\/code> and update its value with <code>languages[Number_Assigned_In_Above_Table]<\/code>. You can get the number assigned to any particular language from the table above.<\/p>\n\n\n\n<p>For Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">...<br>import { languages } from \".\/data\";<br> <br>const state = {<br>    ...,<br>    languages,     \/\/ make sure languages are imported from the data.js file<br>    selectedLocale: languages[0] \/\/ for english, languages[1] for french<br>    ...<br>}<\/pre>\n\n\n\n<h5>How To Add A New Locale<\/h5>\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>German<\/strong> language to the template.<\/p>\n\n\n\n<p>Create a directory with name of locale code inside the <code>src-&gt;lang<\/code> directory. <strong>For German Language Example<\/strong>: create a dictionary with <code>ge<\/code><\/p>\n\n\n\n<p>Create <code>index.js<\/code> file under the directory that you have just created and define the static strings which you want to translate into German, you can check the other locale files to copy all the strings and then convert them to <strong>German<\/strong> language. Example below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/messages.js<br>export default {<br>   general: 'Allgemeines',<br>   overview: '\u00dcberblick'<br>}<\/pre>\n\n\n\n<p>After defining all the strings. Open <code>src-&gt;lang-&gt;index.js<\/code> file and import the file that you have just created. Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">...<br>import ge from '.\/ge';<br> <br>export default {<br>   ...,<br>   ge: {<br>     message: ge<br>   }<br>}<\/pre>\n\n\n\n<p>Now you need to add your locale inside the <code>data.js<\/code> file under the <code>src-&gt;store-&gt;modules-&gt;settings<\/code> directory.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u2026<br> \/\/ languages<br> export const languages = [<br>    {<br>       name: \"English\",<br>       icon: \"en\",<br>       locale: \"en\"<br>    },<br>    {<br>       name: \"French\",<br>       icon: \"fr\",<br>       locale: \"fr\"<br>    },<br>    {<br>       name: \"Hebrew\",<br>       icon: \"he\",<br>       locale: \"he\"<br>    },<br>    {<br>       name: \"Russian\",<br>       icon: \"ru\",<br>       locale: \"ru\"<br>    },<br>    {<br>       name: \"Arabic\",<br>       icon: \"ar\",<br>       locale: \"ar\"<br>    },<br>    \/\/ your locale goes to here<br>    {<br>       name: \"German\",<br>       icon: \"ge\",<br>       locale: \"ge\"<br>    }<br> ]<br> \u2026<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote blockquote-warning\"><p>Make sure you add the new locale at the last position in the array. Also the numbers that are assigned to each language for passing it into the selectedLocale is self incrementing. Take care of the number that is being passed to the selectedLocale accordingly.<\/p><\/blockquote>\n\n\n\n<p>That&#8217;s it, Now you are done with adding a new locale to the template.<\/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=\"193\" 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\">    <\/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=\"193\" 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>Vuely 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 Vuely provide you the options to change the default locale of the template according to your language. You can choose from the given table of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":8,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/docs.theironnetwork.org\/vuely\/wp-json\/wp\/v2\/pages\/193"}],"collection":[{"href":"https:\/\/docs.theironnetwork.org\/vuely\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/docs.theironnetwork.org\/vuely\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/docs.theironnetwork.org\/vuely\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.theironnetwork.org\/vuely\/wp-json\/wp\/v2\/comments?post=193"}],"version-history":[{"count":9,"href":"https:\/\/docs.theironnetwork.org\/vuely\/wp-json\/wp\/v2\/pages\/193\/revisions"}],"predecessor-version":[{"id":871,"href":"https:\/\/docs.theironnetwork.org\/vuely\/wp-json\/wp\/v2\/pages\/193\/revisions\/871"}],"wp:attachment":[{"href":"https:\/\/docs.theironnetwork.org\/vuely\/wp-json\/wp\/v2\/media?parent=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}