How We Built a 10-Language Digital Business Card Studio (With 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. There was just one proble
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.
There was just one problem: it was English-only. For a tool designed to help global professionals network, this was a massive barrier.
Today, we rolled out a major 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 behind-the-scenes look at how we handled the localization entirely on the client side.
1. The Translation Architecture
Because RahaLune is a 100% client-side app, we didn't want to rely on an external API to fetch translations. We wanted the site to remain instantaneous, even if a user switched languages multiple times in a single session.
We structured our translations using standard JSON files for each locale (en.json, fr.json, ar.json, ur.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 our React Context.
// Example of dynamic locale loading
const loadLocale = async (lang) => {
const translations = await import(`./locales/${lang}.json`);
setTranslations(translations.default);
};
This approach keeps the initial JavaScript bundle size small while ensuring subsequent language switches happen with zero network lag.
2. Handling the RTL Layout Challenge
Supporting languages like Arabic and Urdu wasn't just about swapping out stringsβit required a complete mirror flip of the UI.
If you are building a web app with RTL support, the golden rule is to never hardcode directional CSS. Instead of traditional left and right properties, we migrated to CSS Logical Properties:
-
margin-inline-startinstead ofmargin-left -
padding-inline-endinstead ofpadding-right -
inset-inline-startinstead ofleft
We also dynamically update the dir and lang attributes on the root <html> tag whenever the language state changes:
const isRTL = currentLanguage === 'ar' || currentLanguage === 'ur';
document.documentElement.setAttribute('dir', isRTL ? 'rtl' : 'ltr');
document.documentElement.setAttribute('lang', currentLanguage);
This single attribute change tells the browser to natively flip Flexbox containers, CSS Grid tracks, and text alignment. Our 3-step wizard, form inputs, and 3D phone preview all mirror seamlessly without maintaining duplicate stylesheets.
3. Fixing UI Breakage with Text Expansion
German and French translations are notoriously 20% to 30% longer than their English equivalents. In tight UI componentsβlike our 3-step navigation tabs or theme color swatchesβthis immediately caused overflow and clipping bugs.
To make the UI resilient against text expansion, we applied a few defensive CSS patterns:
- Replaced fixed widths with
min-widthand flexibleflex-growrules so buttons could expand gracefully. - Applied
text-wrap: balanceon headings and multi-line buttons to prevent awkward single-word orphans. - Allowed form labels enough vertical breathing room to wrap onto a second line without colliding with inputs.
4. The vCard (.vcf) Encoding Challenge
Generating a .vcf contact file that parses cleanly across both iOS Contacts and Android devices is notoriously finicky. When you introduce non-Latin scripts (like Arabic, Urdu, or accented European characters), improper character encoding results in garbled text (mojibake) when saved to a user's phone.
We had to explicitly enforce UTF-8 encoding (CHARSET=UTF-8) across fields like job titles, company names, and addresses, and test the generated files on physical iOS and Android devices across all 10 locales.
5. Client-Side SEO and hreflang Tags
Even in a Single Page Application (SPA), search engines need clear signals to index localized versions properly. Whenever the active language changes, we dynamically update the <title>, <meta name="description">, and Open Graph tags.
More importantly, we inject hreflang alternate links into the document <head> so crawlers understand the relationship between our localized URLs:
<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" />
<link rel="alternate" hreflang="x-default" href="https://rahalune-qr-studio.vercel.app/business-card" />
This prevents duplicate content penalties and ensures that someone searching in French or Arabic lands directly on the localized version of the studio.
6. Maintaining 100% Client-Side Privacy
The core promise of RahaLune is zero-tracking privacy. We don't have a backend database, we don't store user contact details, and we don't run invasive analytics.
Scaling to 10 languages didn't compromise that architecture. Translation loading, .vcf file generation, and QR code rendering all execute locally inside the user's browser. Personal data never leaves their device.
Try It Out
We now have a Digital Business Card Studio that speaks 10 languages, handles RTL layouts natively, and remains 100% free.
If you want to see how the RTL layout flips the live 3D preview in real time, switch the language to Arabic or Urdu using the header dropdown:
π Try the Multi-Language Digital Business Card Studio
How do you handle i18n and RTL layouts in your React projects? Drop your thoughts or tips in the comments!
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.