π§© ThMLT
Specifications
ThMLT (Theme & Multilanguage Translation) is an advanced extension for App Inventor 2 (AI2) that streamlines theme management (colors & fonts) and enables seamless multilanguage support across your AI2 project.
Overview
Blocks
Methods
Initialize
Purpose: Initializes and loads data for color themes, fonts, and translations.
Parameter | Type |
---|---|
colorThemes | text |
fonts | text |
translations | text |
Need help configuring your Translations, Fonts, or Colors?
Follow the official Data Configuration Guide β to set up your JSON schemas correctly.
ApplyFormatting
Purpose: Applies formatting to a layout using the active theme and language.
Parameter | Type |
---|---|
layout | component |
ApplyCustomizedFormatting
Purpose: Applies formatting to a layout using a specific theme and language.
Parameter | Type |
---|---|
layout | component |
themeMode | text |
languageCode | text |
Get
Purpose: Retrieves a list of values for a given data category.
Parameter | Type |
---|---|
data | All (helper enums) |
Return: list
Why: Returns the complete list of items for enums like PrimitiveKeys
, SemanticKeys
, ThemeModes
, FontTags
, FontShortTags
, TranslationKeys
, SupportedLanguages
.
GetTranslation
Purpose: Returns a translation for a given key using the active language.
Parameter | Type |
---|---|
translationKey | text |
Return: text
Why: Returns the corresponding translation string, or Not Found
if missing.
GetFont
Purpose: Returns a font name for a given key using the tag.
Parameter | Type |
---|---|
tag | text |
Return: text
Why: Returns the corresponding font name, or Font not found
if missing.
GetTranslationForLanguage
Purpose: Returns a translation for a key in a specific language.
Parameter | Type |
---|---|
translationKey | text |
languageCode | text |
Return: text
Why:
- Returns the translation string if found.
- Returns
Not Found
if the key is missing. - Returns
'languageCode' is not supported
if the languageCode is invalid.
GetPrimitiveColor
Purpose: Retrieves a primitive color as an integer value.
Parameter | Type |
---|---|
key | text |
Return: number
Why:
- Returns the integer color value if key exists.
- Returns
-1
if not found (error condition).
GetSemanticColorSource
Purpose: Retrieves the source reference of a semantic color for the active theme.
Parameter | Type |
---|---|
key | text |
Return: text
Why:
- Returns the primitive color key.
- Returns a detailed error if the theme or key doesn't exist.
GetSemanticColor
Purpose: Retrieves a semantic color value (int) for the active theme mode.
Parameter | Type |
---|---|
key | text |
Return: number
Why:
- Returns resolved color as int if found.
- Returns
-1
if theme mode or color key is invalid.
GetSemanticColorByThemeMode
Purpose: Retrieves a semantic color value for a specific theme mode.
Parameter | Type |
---|---|
key | text |
themeMode | text |
Return: number
Why:
- Returns resolved color as int if key exists in the given mode.
- Returns
-1
for missing theme/key.
Properties
Setters
FontRegular
Sets the regular font.
Input | Type |
---|---|
font | text |
FontBold
Sets the bold font.
Input | Type |
---|---|
font | text |
FontMaterial
Sets the material icon font.
Input | Type |
---|---|
font | text |
ColorPrimary
Sets the primary color.
Input | Type |
---|---|
color | number |
ColorSecondary
Sets the secondary color.
Input | Type |
---|---|
color | number |
ColorAccent
Sets the accent color.
Input | Type |
---|---|
color | number |
Language
Sets the active translation language.
Input | Type |
---|---|
code | text |
ThemeMode
Sets the active theme mode (e.g.,
light
,dark
).
Input | Type |
---|---|
mode | text |
Getters
FontRegular
Gets the regular font.
Return | Type |
---|---|
font | text |
FontBold
Gets the bold font.
Return | Type |
---|---|
font | text |
FontMaterial
Gets the material font.
Return | Type |
---|---|
font | text |
ColorPrimary
Gets the primary color.
Return | Type |
---|---|
color | number |
ColorSecondary
Gets the secondary color.
Return | Type |
---|---|
color | number |
ColorAccent
Gets the accent color.
Return | Type |
---|---|
color | number |
Language
Gets the current language code.
Return | Type |
---|---|
code | text |
ThemeMode
Gets the current theme mode.
Return | Type |
---|---|
mode | text |
Usage
Get started with ThMLT in just 3 simple steps β initialize once, format anywhere, and apply your style across the app.
Initialize ThMLT (One-Time Setup)
Set up ThMLT with a single block β no repeated calls needed.
Use the Initialize
block on any screen (commonly Screen1
). ThMLT handles global data sync across all screens automatically.
Best Practice: Call it inside the
Screen.Initialize
block for consistent behavior across the app.
Need help configuring your Fonts, Colors, or Translations?
Follow the official Data Configuration Guide β to set up your JSON schemas correctly.
Format Your TextViews with Style
Use ThMLT's format syntax to apply translation, font, and color in one go β directly within a text string.
[tag1,tag2,tag3]Visible Fallback Text
Example
[name,regular,label]Welcome Back!
Tag | Purpose |
---|---|
name |
![]() |
regular |
![]() shortFontTag in your Fonts JSON) |
label |
![]() Semantic section) |
Welcome Back! |
![]() # is used |
Partial Formatting Control with #
You can skip specific formatting layers by using #
in any of the tag slots inside your [tag1,tag2,tag3]
syntax.
[#,#,#]Text
Each #
tells ThMLT to ignore that particular formatting layer:
Tag Position | Meaning | Example | Result |
---|---|---|---|
1st (# ) |
Skip Translation | [#,bold,label]Hello |
Wonβt translate; applies font & color. Applies fallback text |
2nd (# ) |
Skip Font | [greeting,#,label]Hi |
Uses translation & color, skips font |
3rd (# ) |
Skip Color | [greeting,bold,#]Hi |
Applies translation & font, no color |
![]()
[#,regular,label]Welcome Back!
Skips translation β keeps visible text β applies font + color.
This gives you fine-grained control over how text is styled β even dynamically.
Apply Formatting Block
Use the ApplyFormatting
block to automatically scan all TextViews inside an Arrangement and apply formatting wherever the syntax is detected.
How it works:
- Loops through all text components
- Detects text components that starts with
[tag1,tag2,tag3]
patterns- Applies font, color, and translation instantly
Important Notice
Version 3.0.0
introduces significant breaking changes. Please follow this guide carefully to avoid project breaking issues.
Use chrome extension
Features
Streamlined Project Control: Create, manage, and review projects effortlessly
Intelligent Color Management: Define primitives, map semantics, and switch theme modes to ensure consistent, flexible design
Easy JSON Export: Share project data with a single click
Text Formatter: Edit texts directly from AI2 Builder
Project Management: Import/export JSON data and manage multiple projects
Video Tutorial
v1
V1 - com.hridoy.thmlt.aix (13.0 KB)
AIA - ThMLT_Test.aia (267.6 KB)
v3.0.0 Latest
AIX: com.hridoy.thmlt.aix (26.7 KB)
AIA: ThMLT_3_0_0.aia (317.4 KB)
Open Source
Chrome Extension source