/retool-tutorials

How to implement multi-language support in Retool?

Learn to add multi-language support in Retool with this step-by-step guide, including setting up translations, language selection, and dynamic content updates.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web or mobile app? RapidDev builds Retool apps with your growth in mind.

Book a free No-Code consultation

How to implement multi-language support in Retool?

 

Implementing Multi-Language Support in Retool

 

Adding multi-language support to a Retool application involves comprehensive preparation and custom implementation, given that Retool does not natively support multi-language features. Here is a step-by-step guide to enable multi-language capabilities in your Retool app.

 

Prerequisites

 

  • Access to a Retool account with permission to modify the application settings and code execution.
  • Basic knowledge of Retool's interface, JavaScript and familiarity with resource translation files such as JSON.

 

Structuring Translation Files

 

  • Create JSON files for each language you wish to support. These files should include key-value pairs, with keys being identifiers and values being translated strings.
  • Example for an English language file (en.json):
        {
          "greeting": "Hello",
          "farewell": "Goodbye"
        }
        
  • And a French translation (fr.json):
        {
          "greeting": "Bonjour",
          "farewell": "Au revoir"
        }
        

 

Setting Up a Translation Handling Function

 

  • Navigate to the "scripts" section of your Retool app to define a global JavaScript utility function.
  • This function will dynamically load the appropriate translation file based on a selected language:
  •   function loadTranslations(language) {
        let translations;
        switch (language) {
          case 'en':
            translations = {{ en.json }};
            break;
          case 'fr':
            translations = {{ fr.json }};
            break;
          default:
            translations = {{ en.json }};
        }
        return translations;
      }
      
  • The function uses {{ }} to embed the contents of each JSON translation file directly into the script.

 

Creating a Language Selection Interface

 

  • Add a dropdown component to your Retool app that allows users to select their preferred language.
  • Populate the dropdown with options corresponding to each language you support (e.g., English and French).
  • Bind a temporary state in Retool to track the selected language:
  •   {{tempState.language = yourDropdownComponent.value}}
      

 

Implementing Dynamic Content Translation

 

  • Create a transformer or script that will be triggered whenever the language selection is changed.
  • Use the loadTranslations utility to load translations based on the selected language:
  •   const language = {{tempState.language}};
      const translations = loadTranslations(language);
      
  • For each text component (or any displayable element), apply the translation using the loaded translation database:
  •   {{translations['greeting']}}
      

 

Updating UI Components with Translations

 

  • Ensure all text components in your Retool app reference keys from the translation files using curly braces {{ }} to identify them.
  • If a UI component displays dynamic text, use a JavaScript transformer to ensure the display is updated when the temporary state changes:
  •   {{translations['farewell']}}
      

 

Testing and Validation

 

  • Verify each component correctly displays its respective translation based on the active language selection.
  • Test transitions between different languages to ensure there are no delays or errors in updating UI elements.
  • Check edge cases, such as defaulting to a fallback language if a translation is missing for a selected language.

 

Deploying and Managing Translations

 

  • Prepare deployment by ensuring all resources, JSON translation files, and script references are updated and correctly linked.
  • Regularly update translation files as new text is added to your Retool application. Maintain consistency and validity for each language file.
  • Implement a versioning system to manage translation updates in production efficiently.

 

By following these steps, you can effectively equip your Retool app with multi-language support, thus broadening its accessibility to a wider audience globally.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022