Languages
About this app
The Languages app is a test of ISO 639 languages, ISO 1366 countries, and UNSD M49 regions supported by the Translator and TextToSpeech MIT App Inventor components (as described in iso.ipynb).
This work was inspired by a Github gist posted by missinglink. The additional wrinkle is that (a) the AvailableCountries property of the TextToSpeech component returns ISO 3166-1 Alpha-3 codes and (b) some of those codes are for regions, not simply countries.
Use
The use of the
Languages app follows these basic steps:
- Use Select Valid Language (with SpinnerL) then Language → Country (with SpinnerL2C) to set a valid country for a given language OR Select Valid Country (with SpinnerC) then Country → Language (with SpinnerC2L) to set a valid language for a given country.
- Use Translate to translate the TextBox1.Text sample sentence from the default language (e.g.
en) to the last-selected language. The sample sentence can be modified in the textbox.
- Use Speak to speak the translated sample sentence in the last-selected language of the last-selected country.
Component-level description
- When first clicked, the SpinnerL.Elements property is set to the TextToSpeech1.AvailableLanguages property — which cannot happen in Screen1.Initialize because the AvailableLanguages property is not yet available during initialization.
- When an available language is selected from SpinnerL, the SpinnerL2C.Elements property is set to the list of countries listed in the
country_lookup key in iso-data.json that match the TextToSpeech1.AvailableCountries property for that selected language.
- When first clicked, the SpinnerC.Elements property is the TextToSpeech1.AvailableCountries property — which cannot happen in Screen1.Initialize because the AvailableCountries property is not yet available during initialization.
- When an available country is selected from SpinnerC, the SpinnerC2L.Elements property is set to the list of languages listed in the
language_lookup key in iso-data.json that match the TextToSpeech1.AvailableLanguages property for that selected country.
- When ButtonTranslate is clicked (and based on which Spinner was last clicked), Translator1.RequestTranslation is called with the first two characters only (ISO 639) of the Selection property of the last-clicked of SpinnerL or SpinnerL2C as the
languageToTranslate parameter and TextBox1.Text as the textToTranslate parameter.
- When ButtonSpeak is clicked (and based on which Spinner was last clicked), three things happen:
- TextToSpeech1.Language is set to the Selection property of the last-clicked of SpinnerL or SpinnerL2C
- TextToSpeech1.Country is set to the Selection property of the last-clicked of SpinnerC or SpinnerC2L
- TextToSpeech1.Speak is called with LabelTranslation.Text as the
message parameter.
Further explanation TK…
Code

JSON files
Designer
All components retain their default properties, except for some default Text properties set to their component names. This app takes an approach to component properties that sets everything up at runtime with a setup procedure.