{"id":614,"date":"2025-03-17T06:20:53","date_gmt":"2025-03-17T06:20:53","guid":{"rendered":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/?p=614"},"modified":"2025-06-13T08:25:16","modified_gmt":"2025-06-13T08:25:16","slug":"how-add-a-new-language-into-flutter-app","status":"publish","type":"post","link":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/how-add-a-new-language-into-flutter-app\/","title":{"rendered":"How add a new language into Flutter app?"},"content":{"rendered":"<div class=\"nolwrap\">\n<h3 class=\"wp-block-heading\"><strong>Add a new language into Flutter app<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Estimated reading: 1 minutes<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 1 &#8211; Open Your Project<\/strong><\/h2>\n\n\n\n<p>Open your project in your preferred development IDE.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 2 &#8211; Generate Language Dart File<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Navigate to the&nbsp;<strong>lib \u2192 locale<\/strong>&nbsp;folder.<\/li>\n\n\n\n<li>Create a new Dart file for your new language. For example, if you want to add German, create a file with name&nbsp;<strong><code>language_de.dart<\/code><\/strong>.<\/li>\n\n\n\n<li>Inside&nbsp;<strong><code>language_de.dart<\/code><\/strong>, define a class name&nbsp;<strong>LanguageDe<\/strong>&nbsp;and translate all strings into German.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>TIP<\/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\"><strong>Step 3 &#8211; Update App Localizations<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the&nbsp;<code>app_localizations.dart<\/code>&nbsp;file.<\/li>\n\n\n\n<li>Inside a&nbsp;<code>switch<\/code>&nbsp;statement, add the following code to handle the new language:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">case 'de':<br>  return LanguageDe();<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1387\" height=\"513\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/03\/add_language1.png\" alt=\"\" class=\"wp-image-618\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 4 &#8211; Add Flag Image<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to the&nbsp;<strong>assets \u2192 flags<\/strong>&nbsp;folder.<\/li>\n\n\n\n<li>Add a new language flag image. For example, for French, name the image file as&nbsp;<code>ic_de.png<\/code>.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 5 &#8211; Update Common Base<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the&nbsp;<strong>utils \u2192 common_base.dart<\/strong>&nbsp;file.<\/li>\n\n\n\n<li>Locate the&nbsp;<code>languageList()<\/code>&nbsp;method.<\/li>\n\n\n\n<li>Add a new entry for the added language in the format:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">LanguageDataModel(<br>   id: 2,<br>   name: 'German',<br>   languageCode: 'de',<br>   fullLanguageCode: 'de-DE',<br>   flag: 'assets\/flags\/ic_de.png',<br> ),<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1475\" height=\"312\" src=\"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-content\/uploads\/sites\/6\/2025\/03\/add_language2.png\" alt=\"\" class=\"wp-image-619\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>INFO<\/strong><\/h3>\n\n\n\n<p>Ensure to use the correct language code in both&nbsp;<code>languageCode<\/code>&nbsp;and&nbsp;<code>fullLanguageCode<\/code>. If you don&#8217;t know what&#8217;s language code for your preferred language please do visit this site for getting language code &#8211;&nbsp;<a href=\"https:\/\/www.science.co.il\/language\/Locale-codes.php#definitions\" target=\"_blank\" rel=\"noreferrer noopener\">Click Me!<\/a><\/p>\n\n\n\n<p><\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Add a new language into Flutter app Estimated reading: 1 minutes Step 1 &#8211; Open Your Project Open your project in your preferred development IDE. Step 2 &#8211; Generate Language Dart File TIP 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 [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"parent":69,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-614","post","type-post","status-publish","format-standard","hentry","category-kivilab"],"featured_image_src":null,"author_info":{"display_name":"laraveladminiq","author_link":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/author\/laraveladminiq\/"},"children":[],"_links":{"self":[{"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts\/614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/comments?post=614"}],"version-history":[{"count":5,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts\/614\/revisions"}],"predecessor-version":[{"id":886,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts\/614\/revisions\/886"}],"up":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/posts\/69"}],"wp:attachment":[{"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/media?parent=614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/categories?post=614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/kivilab-laravel\/wp-json\/wp\/v2\/tags?post=614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}