🧩 Overview
When building multilingual Joget apps, it’s important for dropdowns (Select Boxes) to automatically display values in the user’s active language — whether that’s English, Arabic, or any other supported locale.
In this guide, you’ll learn how to configure a Joget Select Box to automatically load the localized label based on the platform’s current language setting.
This approach ensures that users see the same data, but with labels translated according to their locale — all without extra scripting.
⚙️ How It Works
💡 The solution uses:
- A SQL query as the Select Box’s options source.
- Joget’s variable
#platform.currentLanguage#to detect the logged-in user’s interface language. - A CASE statement in SQL to conditionally choose between Arabic and English column names.
Whenever the user changes the platform locale (via User Profile or /web/userview language toggle), the dropdown automatically displays the correct labels.
💻 Full Code
Use the following SQL query in your Select Box’s “Options Binder → JDBC Binder → SQL Query”:
SELECT
c_code AS value,
CASE '#platform.currentLanguage#'
WHEN 'ar' THEN c_name_ar
ELSE c_name_en
END AS label
FROM app_fd_governate_mst
ORDER BY label
✅ Explanation:
-
c_code→ The stored value in Joget (e.g.,001,002, etc.) -
c_name_en→ English name of the location -
c_name_ar→ Arabic name of the location -
#platform.currentLanguage#→ Joget’s built-in variable that returns"ar","en", or another locale code depending on the user’s active language
🧠 Example Use Cases
🌍 Government or Region Dropdowns — show English or Arabic names dynamically.
🏢 Branch Selector — display localized branch names based on user locale.
🏫 School / University Lists — handle multilingual labels seamlessly.
📦 Product Category Selector — automatically adjust category names to the interface language.
🛠️ Customization Tips
💡 Add more languages:
You can extend the CASE statement to support multiple locales:
CASE '#platform.currentLanguage#'
WHEN 'ar' THEN c_name_ar
WHEN 'fr' THEN c_name_fr
ELSE c_name_en
END
⚙️ Default language fallback:
ELSE c_name_en ensures that English labels appear when no match is found.
🗂️ Table naming convention:
Keep your table name generic — e.g., app_fd_location_mst — to avoid exposing project-specific data.
🌟 Key Benefits
✅ Fully automatic localization — no extra scripting or filters required.
⚙️ Simple SQL-only setup — works directly in Select Box configuration.
💬 Consistent user experience — respects platform locale settings.
📱 Multilingual scalability — add new columns and locales easily.
🔒 Security Note
⚠️ Always ensure that:
- The SQL query only reads from safe, authorized tables.
- No sensitive information is exposed via the
labelcolumn. - Use parameterized queries if dynamic filtering is added later.
Top comments (0)