Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 3 min read

How We Built a 10-Language Digital Business Card Studio (With Full RTL Support)

When we launched the RahaLune Digital Business Card Studio, it was a fully functional, client-side React application that allowed users to create a digital business card and generate a QR code. But there was a problem.

When we launched the RahaLune Digital Business Card Studio, it was a fully functional, client-side React application that allowed users to create a digital business card and generate a QR code.

But there was a problem. It was English-only. For a tool designed to help global professionals network, this was a massive barrier.

Today, we rolled out a massive update. The entire Digital Business Card Studio 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 API to fetch translations. We wanted the site to remain incredibly fast, even if the user switched languages multiple times.

We used standard JSON files for each language (en.json, fr.json, ar.json, etc.). When the 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 that the translation happens instantly.

Handling the RTL Layout Challenge

Supporting Arabic and Urdu wasn't just about translating the 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, you should 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');

This single attribute ensures that flexbox layouts, grid systems, and text alignment seamlessly flip for RTL languages. The 3-step wizard, the form inputs, and the 3D phone preview all mirror perfectly 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 the 3-step navigation tabs or the theme swatches, this causes major layout breakage.

To fix this, we ensured our CSS had flexible containers. We used text-wrap: balance and allowed certain buttons to grow gracefully rather than clipping the text. For the form inputs, we ensured the labels had enough room to wrap to a second line if necessary.

The vCard Generation Challenge

Generating a vCard (.vcf) file that works across both iOS and Android is tricky. We had to ensure that the translated text (like job titles and company names) were properly encoded to prevent formatting issues when saved to a phone's address book. We tested this extensively across multiple languages, including RTL.

SEO and Hreflang Tags

Since 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 exactly where the different language versions are hosted:

<link rel="alternate" hreflang="en" href="https://rahalune-qr-studio.vercel.app/business-card?lang=en" />
<link rel="alternate" hreflang="fr" href="https://rahalune-qr-studio.vercel.app/business-card?lang=fr" />
<link rel="alternate" hreflang="ar" href="https://rahalune-qr-studio.vercel.app/business-card?lang=ar" />

This prevents duplicate content penalties and ensures that a user 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. We don't track analytics.

Adding 10 languages didn't change that. All translation loading, vCard generation, and QR code rendering happen directly in the browser. The user's data never leaves their device.

Try It Out

We now have a Digital Business Card Studio that speaks 10 languages, handles RTL flawlessly, and remains 100% free forever.

If you want to see how the RTL layout handles the live preview, switch the language to Arabic or Urdu using the header dropdown here:

Try the Multi-Language Digital Business Card Studio

Let me know what you think of the implementation!

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.