TechBuzzPro

Accessible i18n Pipeline: Metadata, Screen Readers, EU Rules

· 5 min read · Windows & PC

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

This guide walks you through building an internationalization (i18n) pipeline that is accessible to screen reader users and compliant with EU accessibility rules. You'll learn how to structure language metadata, handle translations, and test your output—so your content works for everyone, in every language.

What You'll Need

  • A basic understanding of HTML, CSS, and JavaScript (or your framework of choice).
  • Access to your codebase and a way to deploy changes.
  • A translation management system or a simple JSON/PO file structure.
  • A screen reader for testing (NVDA, VoiceOver, or TalkBack).
  • Familiarity with your target EU markets and their language requirements.

Step-by-Step

  1. Define language metadata in your HTML. Start with the lang attribute on the <html> element. Use the correct ISO 639-1 code (e.g., en, fr, de). For regional variants, use the full tag like en-GB or fr-CA. This is the single most important step for screen readers—it tells them which pronunciation and character set to use.
  2. Set the dir attribute for RTL languages. If your pipeline supports Arabic or Hebrew, add dir="rtl" to the <html> element. Ensure your CSS uses logical properties (like margin-inline-start) instead of physical ones (like margin-left) so layouts flip automatically.
  3. Use a standard i18n framework. Choose a library like i18next, react-i18next, or Vue I18n. These handle variable interpolation, pluralization, and date/number formatting. They also let you load translations asynchronously, which is essential for performance.
  4. Organize translation files with fallbacks. Store translations in JSON files per locale (e.g., en.json, fr.json). Always have a fallback locale (usually English) so that missing keys don't break the UI. In your i18n config, set fallbackLng to your default language.
  5. Handle dynamic content and placeholders. For strings with variables, use placeholders like . Never concatenate strings manually—this breaks word order in other languages. For plurals, use the framework's plural rules; for example, in English: one item vs. many items , but in Russian there are three forms.
  6. Ensure screen reader announcements for language switches. When the user changes the language, update the lang attribute on the <html> element dynamically. Use aria-live="polite" on a status region to announce the change, e.g., "Language changed to French."
  7. Provide accessible labels for language selectors. The language switcher should have an accessible name, like "Select language." Use a native <select> element with a <label>, or a button with aria-haspopup="listbox". Ensure the current language is indicated with aria-current="true".
  8. Translate all UI text, including ARIA labels. Don't forget alt text, button labels, and form placeholders. Use your i18n function for these too. For example, in React: t('search.placeholder').
  9. Test with screen readers in multiple languages. Use NVDA (Windows) with different language packs, VoiceOver (macOS/iOS), and TalkBack (Android). Verify that the screen reader correctly switches voice and pronunciation when the lang attribute changes.
  10. Comply with EU accessibility rules. The European Accessibility Act (EAA) and EN 301 549 require that public sector websites and apps meet WCAG 2.1 AA. This includes providing text alternatives, adaptable content, and compatibility with assistive technologies. Your i18n pipeline must not introduce barriers—for example, don't hide translated content with display:none if it's meant to be read.
  11. Implement automated checks. Add a linter rule to ensure every string is wrapped in a translation function. Use a tool like i18next-scanner to extract keys and detect missing translations. In CI/CD, run a script that fails if any locale is missing a key.
  12. Document your pipeline. Create a README that explains how to add a new language, how to handle plural rules, and how to test accessibility. This helps future developers maintain the system.

Common Mistakes

  • Forgetting the lang attribute on dynamic content. If you inject HTML with a different language, wrap it in an element with the correct lang attribute.
  • Using physical CSS properties for RTL. This breaks layouts when switching to Arabic or Hebrew.
  • Hardcoding strings in components. This makes translation impossible and creates inconsistencies.
  • Ignoring pluralization rules. English has two forms, but other languages have more. Always use the framework's pluralization.
  • Not testing with real screen readers. Automated tools can't catch pronunciation issues or missing announcements.

Tips

  • Use a translation management platform like Crowdin or Lokalise to collaborate with translators and keep keys organized.
  • Cache translations in the browser to reduce load times. Use a service worker or local storage.
  • Set the content-language meta tag for SEO, but remember that the lang attribute is what screen readers use.
  • Use a language detector for initial locale, but always let the user override it.
  • Provide a visual indicator of the current language in the UI, not just for screen readers.

Troubleshooting

  • Screen reader reads the wrong language. Check that the lang attribute is correctly set on the <html> element and that it updates on language change. Also verify that the screen reader's language pack is installed.
  • Translations not loading. Check the network tab for 404 errors. Ensure your fallback locale is set, and that the JSON file paths are correct.
  • RTL layout looks broken. Review your CSS for physical properties. Use the browser's RTL testing tools or add dir="rtl" manually to see the issue.
  • Missing keys in production. Run a build-time check to compare key sets across locales. If a key is missing, the fallback will be used, but you should be notified.
  • Screen reader doesn't announce language change. Ensure the aria-live region is present in the DOM before the change and that the text is changed after the lang attribute is updated.

Frequently Asked Questions

Do I need to set the lang attribute on every element?

No, only on the <html> element and on any element that contains content in a different language. This is sufficient for screen readers.

Can I use machine translation for my pipeline?

Yes, but you must review it for accuracy and cultural nuances. Machine translation can be a starting point, but human review is essential for quality and accessibility.

How do I handle languages with different text directions?

Set dir="rtl" on the root element and use logical CSS properties. Your i18n framework should also handle this automatically if configured.

What is the European Accessibility Act and does it apply to me?

The EAA is an EU directive that requires products and services to be accessible to people with disabilities. It applies to most public-facing websites and apps, regardless of your company's location, if you serve EU citizens.

How do I test screen reader support for multiple languages?

Install the appropriate language packs for your screen reader. For NVDA, go to Settings > Language and select the language. Then navigate your site and listen for correct pronunciation.

Should I use a polyfill for the lang attribute?

No, the lang attribute is fully supported in all modern browsers and assistive technologies. No polyfill needed.