Sitemap
Ümit Mutlu

Ümit Mutlu

iOS & Flutter Developer

Flutter Localization

3 min readSep 11, 2022
Press enter or click to view image in full size

Hello, imagine you are developing an application and this application is in all countries in the local language of those countries, to tell you the advantages and disadvantages of it, for example, you are planning to make a paid application and you need to inform the users what they are paying for and I can say that it is advantageous because of these and similar principles, it will come to the disadvantages. Let’s think of a sentence in cases where the font size should be fixed, for example, this word can be 50 characters in Turkish and we need to localize it considering this.

Let’s go to the project immediately, we write flutter create in the terminal as in the figure and we create the project.

Press enter or click to view image in full size

We download our library as in the picture below and if we want, we can write flutter pub get to the terminal or we can press the pub get button in the pubspec.yaml folder.

Press enter or click to view image in full size

now we create a folder named assets in the main directory as in the figure and add the languages folder inside it, paying attention to the unicodes, we create json files, for example -> en-EN.json and in the json format in the json file, we need to fill the left part by evaluating it as a variable and the right part as a value.

Get Ümit Mutlu’s stories in your inbox

Join Medium for free to get updates from this writer.

For the iOS part, it is necessary to write the languages ​​supported by the application in unicode form in the ios/Runner/info.plist file as shown in the figure.

Press enter or click to view image in full size
Info.plist
Press enter or click to view image in full size

and configure the main.dart folder as in the figure

and then go to the main directory of the project via terminal and paste the code “flutter pub run easy_localization:generate -O lib/generated -f keys -o locale_keys.g.dart — source-dir assets/languages”

You should see it like in the picture below

Press enter or click to view image in full size

Finally, we place our String expressions inside the Text widget in this way and we have completed the localization in all our projects.

--

--