{
  "id": 514811,
  "title": "Supporting Language Switching for Date Formats, Not Just Text, with i18next",
  "url": "https://urgent.news/2026/08/11/supporting-language-switching-for-date-formats-not-just-text-with",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-11T00:02:58.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/hirodeath/supporting-language-switching-for-date-formats-not-just-text-with-i18next-1h8h"
  },
  "original_language": "en",
  "account": "A React Native application integrated with i18next, a popular internationalization library, encountered an issue where dates displayed in Japanese remained unchanged despite efforts to translate surrounding text. This discrepancy arose because direct date formatting was not compatible with more extensive translation JSON files. To resolve this, the author unified language detection and applied it to Intl.DateTimeFormat.\n\nThree language preference settings were established: Japanese, English, and device-default, bringing the total to three distinct options. These preferences are stored securely, and the device's locale is detected using Hermes' Intl.DateTimeFormat function. When the system language is selected, the detected device locale is utilized. This implementation involves calling i18n.changeLanguage whenever the UI undergoes modifications.\n\nPreviously, months and weekdays were managed through arrays, with strings being assembled manually. This approach has been replaced by Intl.DateTimeFormat, simplifying the process. The formatScheduleDate function takes a Date object and language preference, returning a formatted date string according to the specified locale.\n\nIn the application's components, i18n.resolvedLanguage is employed to ensure consistency with i18next's adopted language, including fallback options. The language setting is integrated throughout the app, starting with saving language preferences, followed by the dashboard and tabs. Main screens for attendance registration, settings, notifications, admin screens, and date displays were addressed next. By addressing date support last, the author could verify its functionality independently from text translation gaps.\n\nThe order of implementing language support was crucial, starting with language saving, progressing through the dashboard and tabs, and concluding with main screens, settings, notifications, admin screens, and date displays. This method allowed for the verification of date support separately from text translation gaps. The translation coverage gradually increased, beginning with handling dates, times, numbers, and error messages, which also needed to adapt to the language setting.\n\nUltimately, the author emphasizes that merely examining strings passed through the translation function does not signify the completion of multi-language support. Displays generated outside JSON files must also connect to the language setting. This comprehensive approach ensures that i18next effectively manages both text translation and date formatting, providing a seamless user experience in multiple languages.",
  "summary": "This article is an English translation of the original Japanese article. After introducing i18next to a React Native app, dates like 7月24日(金) remained in Japanese on the screen. Just adding more translation JSON does not change places where Date is directly formatted. To avoid having text and dates in different languages, I unified the language detection and passed it to Intl.DateTimeFormat .…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 2,
    "also_reported_by": [
      {
        "outlet": "Dev.to",
        "title": "Cómo solucionar el error \\\"Text content does not match server-rendered HTML\\\" en Next.js App Router",
        "url": "https://urgent.news/2026/08/10/como-solucionar-el-error-text-content-does-not-match-server-rendered",
        "published": "2026-08-10T10:11:12.000Z"
      }
    ]
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}