MIT App Inventor – Multilingual android app creation

If you want to distribute your android application more widely, you may want to make it available in multiple languages. With MIT App Inventor, you can easily create a multilingual android application.

Dein Smartphone mit Android 11: Einfach alles können

Dein Smartphone mit Android 11 – Einfach alles können

Die besten Tipps und Tricks für alle Geräte Samsung, Sony, HTC, LG, etc…

werbung – amazon.de

If you are unfamiliar with MIT App Inventor, read my article on Android programming for beginners – MIT App Inventor .

The zip files associated with this article also include the project file (.aia) and the installable application (.apk). It has not been extensively tested, I have only tried it on my own phone, so install it at your own risk.

The project files for this article can be downloaded here: MultilingualAppExample.zip

You can use MIT App Inventor – a simple android menu as a starting point :   MenuExample.zip .

The new application will be available in three languages, English, German and Hungarian.

First, expand the ‘MenuExample’ screens on the ‘Designer’ page. Add a ‘TinyDB’ component from the ‘Storage’ submenu to each screen.

MIT App Inventor - Multilingual Android App Home Screen
MIT App Inventor – Multilingual Android App Home Screen

Also, add a ‘HorizontalArrangement’ to the ‘Settings’ screen, then place a ‘ListPicker’ and a ‘Label’ component on it. Give the components a name that makes them easy to recognize so that the blocks are more transparent in the block editor.

In this case, I named ‘LanguageListPicker’ and ‘LanguageLabel’.

MIT App Inventor - Multilingual Android App Settings Screen
MIT App Inventor – Multilingual Android App Settings Screen

Add ‘Language’ to the ‘LanguageListPicker’ button and [English, Deutsch, Magyar] for ‘ElementsFromString’.

When we’re done, we can go to the block editor. Let’s start with the blocks on the ‘Settings’ screen.

MIT App Inventor - Settings Blocks
MIT App Inventor - Settings Blocks
MIT App Inventor – Settings Blocks

The first block is responsible for closing the screen, this is already known from the ‘MenuExample’ application. this is expanded with the following blocks.

In the second block, when you open the ‘Settings’ screen, you will query the database for the previously saved language settings. If not found (for example, when you start the application for the first time), the default language is English. We then change the values ​​of the ‘Text’ fields for the components.

The third block is run by clicking on the ‘LanguageListPicker’ button. Here the settings for the selected language are saved in the database and the ‘Text’ values ​​are modified accordingly.

Next, edit the blocks on the home screen of our android app. The first block below is the block for the menu.

MIT App Inventor - Home Menu Blocks
MIT App Inventor – Home Menu Blocks

Then add the following two blocks. The second block runs when the application is opened. The database retrieves the saved language settings. If this fails, the default language is English, just as when opening the ‘Settings’ screen. We then rewrite the values ​​in the ‘Text’ fields accordingly.

MIT App Inventor - Home Screen Blocks
MIT App Inventor - Home Screen Blocks
MIT App Inventor – Home Screen Blocks

The third block does the same thing as the previous one, it only runs when another screen is closed, so they come back here.

And the ‘About’ screen. To do this, add a database component.

MIT App Inventor - Multilingual Android App About Screen
MIT App Inventor – Multilingual Android App – About Screen

Let’s see the block editor, there’s no big magic here either. The first block is activated when the ‘About’ screen is opened. We also read the language settings from the database and modify the text elements.

MIT App Inventor - About Screen Blocks
MIT App Inventor - About Screen Blocks
MIT App Inventor – About Screen Blocks

The next two blocks call the ‘ActivityStarter’ component when you press two clickable items, a button, or an image. This component allows you to open another app on your device. In this case, open the web browser with the specified parameters.

The last block closes the screen by clicking the close button. we are ready for that.

By completing this example, you can easily create your own multilingual application.