Back to Blog
January 14, 20267 min readGenerating Internationalized UIs

Generating Internationalized UIs from Video Translations

R
Replay Team
Developer Advocates

TL;DR: Replay enables the creation of internationalized UIs directly from video recordings of translated app flows, streamlining the localization process and ensuring accurate representation of user behavior across different languages.

The Localization Bottleneck: Beyond Simple Text Replacement#

Traditional UI localization often involves replacing text strings with their translated counterparts. This approach, while functional, often overlooks critical aspects of user experience. Layout adjustments, cultural nuances in interaction patterns, and even the visual flow of an application can differ significantly across languages. Simply swapping text can lead to broken layouts, confusing navigation, and ultimately, a degraded user experience.

Consider a scenario where an e-commerce application needs to be localized for a right-to-left (RTL) language like Arabic. Not only does the text need translation, but the entire UI layout must be mirrored. Manually recreating the UI flow, especially for complex applications, is time-consuming and prone to errors. This is where Replay offers a revolutionary approach.

Behavior-Driven Localization: Video as the Source of Truth#

Replay analyzes video recordings of users interacting with a translated version of your application. This "Behavior-Driven Reconstruction" allows it to understand not just the visual elements, but also the intent behind the user's actions. This is crucial for accurately capturing the nuances of internationalized UIs.

Instead of relying on static screenshots or incomplete design specifications, Replay uses the video as the source of truth, ensuring that the generated code reflects the actual user experience in the target language.

Key Benefits of Replay for Internationalization:#

  • Accurate UI Reconstruction: Replay captures the precise layout and behavior of the internationalized UI as demonstrated in the video.
  • Behavioral Understanding: It analyzes user interactions to understand the intended flow, even if the layout differs significantly from the original.
  • Reduced Manual Effort: Automates the process of recreating internationalized UIs, saving significant development time.
  • Improved User Experience: Ensures that the generated UI is optimized for the target language and cultural context.

Generating Internationalized UIs with Replay: A Step-by-Step Guide#

Here's a practical example of how to use Replay to generate an internationalized UI from a video recording:

Step 1: Record the Translated App Flow#

Record a video of a user interacting with the translated version of your application. This video should showcase all the key user flows and UI elements that need to be localized. For example, if you're localizing a registration process for a Spanish-speaking audience, record a user completing the registration flow in Spanish.

📝 Note: Ensure the video is clear and captures all relevant UI elements and user interactions.

Step 2: Upload the Video to Replay#

Upload the video recording to Replay. The engine will then analyze the video to understand the UI elements, user interactions, and overall application flow.

Step 3: Configure Replay Settings#

Configure Replay settings to specify the target language and any specific localization requirements. This may include specifying the text direction (LTR or RTL), font preferences, and other language-specific settings.

Step 4: Generate the Code#

Initiate the code generation process. Replay will use its AI-powered engine to reconstruct the UI based on the video recording and the configured settings. The generated code will be clean, well-structured, and ready to be integrated into your project.

Step 5: Integrate and Customize#

Integrate the generated code into your application. You can then further customize the UI as needed to fine-tune the user experience.

Code Example: Implementing RTL Support#

Here's an example of how Replay might generate code to implement RTL support in a React application:

typescript
// Example of generated code for RTL support import React from 'react'; import { useTranslation } from 'react-i18next'; const MyComponent = () => { const { t, i18n } = useTranslation(); const isRTL = i18n.language === 'ar'; // Example: Arabic return ( <div style={{ direction: isRTL ? 'rtl' : 'ltr' }}> <h1>{t('welcomeMessage')}</h1> <p>{t('description')}</p> </div> ); }; export default MyComponent;

This code snippet demonstrates how Replay can automatically detect the language and apply the appropriate directionality to the UI elements. The

text
useTranslation
hook from
text
react-i18next
is used to manage translations, and the
text
direction
style is dynamically set based on the language.

Comparison with Traditional Localization Methods#

FeatureTraditional Localization (String Replacement)Screenshot-to-Code ToolsReplay
Video Input
Behavior AnalysisPartial (Limited to visual elements)
UI Reconstruction AccuracyLow (Layout issues common)Medium (Based on static images)High (Video-based, behavior-driven)
Language SupportLimited to textLimited to visual elementsComprehensive (Behavior and UI)
Cultural Nuance Understanding
RTL SupportRequires manual implementationRequires manual implementationAutomatic (Based on video evidence)

Supabase Integration for Dynamic Content#

Replay seamlessly integrates with Supabase, allowing you to manage your translated content dynamically. You can store your translations in a Supabase database and fetch them in real-time, ensuring that your UI always displays the most up-to-date translations.

typescript
// Example of fetching translations from Supabase import { createClient } from '@supabase/supabase-js'; const supabaseUrl = 'YOUR_SUPABASE_URL'; const supabaseKey = 'YOUR_SUPABASE_ANON_KEY'; const supabase = createClient(supabaseUrl, supabaseKey); const fetchTranslations = async (language: string) => { const { data, error } = await supabase .from('translations') .select('*') .eq('language', language); if (error) { console.error('Error fetching translations:', error); return null; } return data; }; // Usage example const translations = await fetchTranslations('es'); // Fetch Spanish translations console.log(translations);

This code demonstrates how to use the Supabase client to fetch translations from a database table. You can then use these translations to dynamically update your UI.

💡 Pro Tip: Use Supabase's real-time capabilities to automatically update your UI whenever translations are updated in the database. This ensures that your users always see the latest translations.

⚠️ Warning: Ensure your Supabase API keys are securely stored and not exposed in your client-side code. Use environment variables or a secure configuration management system.

Product Flow Maps for Internationalized Applications#

Replay generates product flow maps that visually represent the user journey through your application. These maps are particularly useful for understanding how users from different cultural backgrounds interact with your application. By analyzing the flow maps, you can identify potential areas for improvement and optimize the user experience for each target language.

Style Injection for Consistent Branding#

Replay allows you to inject custom styles into the generated code, ensuring that your internationalized UI maintains a consistent brand identity. You can define global styles, component-specific styles, and even language-specific styles to tailor the visual appearance of your application for each target audience.

📝 Note: Use CSS variables to manage your styles and make it easy to update them across your application.

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free tier with limited features. Paid plans are available for more advanced features and higher usage limits. Check the Replay pricing page for the latest details.

How is Replay different from v0.dev?#

While v0.dev primarily focuses on generating UI components from text prompts, Replay analyzes video recordings of user interactions. This "Behavior-Driven Reconstruction" allows Replay to understand the intent behind the user's actions, resulting in more accurate and functional code, especially for complex UI flows and internationalized applications. Replay goes beyond simple visual replication, capturing the nuances of user behavior and translating them into code.

What types of video formats does Replay support?#

Replay supports most common video formats, including MP4, MOV, and WebM.

Can I use Replay with my existing codebase?#

Yes, Replay generates clean, well-structured code that can be easily integrated into your existing codebase.


Ready to try behavior-driven code generation? Get started with Replay - transform any video into working code in seconds.

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free