{"id":74,"date":"2025-03-05T06:23:03","date_gmt":"2025-03-05T06:23:03","guid":{"rendered":"https:\/\/documentation.iqonic.design\/streamit-tv\/?p=74"},"modified":"2025-06-12T10:21:12","modified_gmt":"2025-06-12T10:21:12","slug":"how-to-add-a-new-app-language-into-flutter-app","status":"publish","type":"post","link":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/how-to-add-a-new-app-language-into-flutter-app\/","title":{"rendered":"How to add a new app language into flutter app?"},"content":{"rendered":"<div class=\"nolwrap\">\n<h2 class=\"wp-block-heading\" id=\"step-1---generate-language-dart-file\"><strong>Step 1 &#8211; Generate Language Dart File<\/strong><a href=\"https:\/\/apps.iqonic.design\/documentation\/streamit-laravel-documentation\/build\/docs\/user-guide\/mobile-app\/add-a-new-language-into-app#step-1---generate-language-dart-file\" target=\"_blank\" rel=\"noopener\">\u200b<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Navigate to the lib \u2192 locale folder.<\/li>\n\n\n\n<li>Create a new Dart file for your new language. For example, if you want to add spanish create a file with name \u201clanguage_es.dart\u201d.<\/li>\n\n\n\n<li>Inside \u201clanguage_es.dart\u201d, define a class name LanguageEs and translate all strings into Spanish.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>NOTE<\/strong><\/h3>\n\n\n\n<p>You can follow the convention of naming them as language_languageCode.dart, where languageCode represents the ISO 639-1 language code for the language.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<p>English: language_en.dart Spanish: language_es.dart French: language_fr.dart<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-2---update-app-localizations\"><strong>Step 2 &#8211; Update App Localizations<a href=\"https:\/\/apps.iqonic.design\/documentation\/streamit-laravel-documentation\/build\/docs\/user-guide\/mobile-app\/add-a-new-language-into-app#step-2---update-app-localizations\" target=\"_blank\" rel=\"noopener\">\u200b<\/a><\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the \u201capp_localizations.dart\u201d file. it will be inside locale directory.<\/li>\n\n\n\n<li>Inside a switch statement, add the following code to handle the new language:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">   case 'es':<br>       return LanguageEs();<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 3 &#8211; Add Flag<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to the assets \u2192 flags folder. Add a new language flag image. For example, for spanish, name the image file as ic_Spanish.png. If you have installed Assets generator plugin then no need to perform next step.<\/li>\n\n\n\n<li>Go to lib \u2192 generated \u2192 assets.dart and add constant for image file<\/li>\n\n\n\n<li>find &#8220;assets\/flags&#8221; then add line below<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">static const String flagsIcEs = 'assets\/flags\/ic_es.png';<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 4 &#8211; Update languageList() in Constants<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the lib \u2192 utils \u2192 common_base.dart file.<\/li>\n\n\n\n<li>Locate the languageList() method.<\/li>\n\n\n\n<li>Add a new entry for the added language in the format:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">LanguageDataModel<br>(<br>id: 4,<br>name: locale.value.Spanish,<br>languageCode: 'es',<br>fullLanguageCode: 'es-Es',<br>flag: Assets.flagsIcEs,<br>),<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>IMPORTANT<\/strong><\/h3>\n\n\n\n<p>Ensure to use the correct language code in both languageCode and fullLanguageCode. If you don\u2019t know what\u2019s language code for your preferred language please do visit this site for getting language code \u2013 Click here!<\/p>\n\n\n\n<p><\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Step 1 &#8211; Generate Language Dart File\u200b NOTE You can follow the convention of naming them as language_languageCode.dart, where languageCode represents the ISO 639-1 language code for the language. For example: English: language_en.dart Spanish: language_es.dart French: language_fr.dart Step 2 &#8211; Update App Localizations\u200b case &#8216;es&#8217;: return LanguageEs(); Step 3 &#8211; Add Flag static const String [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"parent":60,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-streamittv"],"featured_image_src":null,"author_info":{"display_name":"laraveladminiq","author_link":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/author\/laraveladminiq\/"},"children":[],"_links":{"self":[{"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":3,"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":626,"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/posts\/74\/revisions\/626"}],"up":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/posts\/60"}],"wp:attachment":[{"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/streamit-tv-app\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}