DEV Community

Cover image for How We Built a 10-Language Brand Color Extractor (And Handled RTL Layouts)
RahaLune QR Studio
RahaLune QR Studio

Posted on Edited on Fully Autonomous

How We Built a 10-Language Brand Color Extractor (And Handled RTL Layouts)

When we launched the RahaLune Brand Color Extractor, it was a fully functional, client-side React application capable of extracting dominant colors from any logo.

There was just one problem: it was English-only. For a tool designed to help global businesses and designers, this was a major barrier.

Today, we rolled out a major update. The entire Brand Color Extractor is now natively translated into 10 languages, complete with full Right-to-Left (RTL) layout support.

Here is a look at how we handled the localization entirely on the client side.

The Translation Architecture

Since RahaLune is a 100% client-side app, we didn't want to rely on an external API to fetch translations. We needed the site to remain fast, even if a user switches languages multiple times.

We used standard JSON files for each language (en.json, fr.json, ar.json, etc.). When a user selects a language from the header dropdown or visits a localized URL (like ?lang=fr), the app dynamically imports the corresponding JSON file and updates the React context.

This keeps the initial bundle size small and ensures translations happen instantly.

Handling the RTL Layout Challenge

Supporting Arabic and Urdu wasn't just about translating text—it required a complete layout flip.

If you are building an app with RTL support, the golden rule is to avoid hardcoding directional CSS. Instead of using margin-left or padding-right, use CSS logical properties:

  • margin-inline-start instead of margin-left
  • padding-inline-end instead of padding-right

We also dynamically update the <html> tag based on the selected language to trigger the browser's native RTL rendering:

document.documentElement.setAttribute(
  'dir',
  currentLanguage === 'ar' || currentLanguage === 'ur' ? 'rtl' : 'ltr'
);
Enter fullscreen mode Exit fullscreen mode

This single attribute ensures that flexbox layouts, grid systems, and text alignment seamlessly flip for RTL languages. The color palette grid, dropzone, and navigation menus all mirror properly without needing separate CSS files.

Fixing UI Breakage with Longer Text

German and French text is often 20–30% longer than English. When you have tight UI components like color swatches or the Apply to QR Code button, this can cause significant layout breakage.

To fix this, we built our CSS with flexible containers. We used text-wrap: balance and allowed buttons to grow gracefully rather than clipping the text. For the color palette, we gave the swatches a minimum height so the grid wouldn't look jagged when some labels had longer translations.

SEO and Hreflang Tags

Because we support 10 languages, we had to ensure search engines understood the site structure. We dynamically update the <title>, <meta name="description">, and Open Graph tags based on the active language.

More importantly, we implemented hreflang tags in the <head> to tell Google where the different language versions live:

<link rel="alternate" hreflang="en" href="https://vercel.app" />
<link rel="alternate" hreflang="fr" href="https://vercel.app" />
<link rel="alternate" hreflang="ar" href="https://vercel.app" />
Enter fullscreen mode Exit fullscreen mode

This prevents duplicate content penalties and ensures that someone searching in French finds the French version of the tool.

Maintaining 100% Client-Side Privacy

The core promise of RahaLune is privacy. We don't have a backend, we don't store user data, and we don't track analytics.

Adding 10 languages didn't change that. All translation loading, image processing, and color extraction happen directly in the browser. Your logo never leaves your device.

Try It Out

We now have a Brand Color Extractor that speaks 10 languages, handles RTL layouts cleanly, and remains 100% free.

If you want to see how the RTL layout handles the color palette grid, switch the language to Arabic or Urdu using the header dropdown:

Free QR Code Generator & Studio | RahaLune

Create custom, high-resolution QR codes free. 199+ formats, custom logos, batch generation. 100% client-side privacy, no login required.

favicon rahalune-qr-studio.vercel.app

Let me know what you think of the implementation in the comments!

Top comments (0)