Skip to content

Internationalization (i18n) #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 27, 2025
Merged

Conversation

danditomaso
Copy link
Collaborator

@danditomaso danditomaso commented May 23, 2025

Description

This pull request introduces internationalization (i18n) support for the web client, this is one part of a larger overall effort to support multiple languages across all Meshtastic apps. Hardcoded strings have been extracted from various React components and replaced with translation keys using react-i18next. The en.json locale file is the base strings file where all other translations will be based on this file, future strings added to the app will need a corresponding key as well.

The primary goal of these changes is to make the application more accessible and maintainable for future localization efforts.

Related Issues

Organisation wide effort
Fixes #57

Changes Made

Replaced strings in the following components:

  • Dialogs
  • Configuration pages (Device and Module config tabs, main config page titles, and toast messages)
  • Nodes page (table content and status messages)
  • Messaging page
  • Map page
  • Individual configuration sections (Bluetooth, Device, Display, LoRa, Network, Position, Power, Security)
  • Core UI elements like Input fields and Filter controls
  • Dashboard page

Checklist

  • Code follows project style guidelines
  • Documentation has been updated or added
  • Tests have been added or updated
  • All CI checks pass
  • Dependent changes have been merged

Additional Notes

@danditomaso danditomaso requested review from Hunter275 and Copilot May 23, 2025 00:59
Copy link

vercel bot commented May 23, 2025

@danditomaso is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds internationalization support for the web client by replacing hardcoded string literals with translation keys via the react-i18next library. Key changes include:

  • Refactoring of multiple dialogs, components, and UI elements to use translation functions.
  • Updates to package.json for i18next and related plugins.
  • Adjustments to component logic to include i18next hook integrations.

Reviewed Changes

Copilot reviewed 52 out of 52 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/components/KeyBackupReminder.tsx Uses t() for backup reminder message.
src/components/Dialog/UnsafeRolesDialog.tsx Refactors dialog titles/descriptions with translation keys.
src/components/Dialog/TracerouteResponseDialog.tsx Uses translations for dialog title and fallback node names.
src/components/Dialog/ShutdownDialog.tsx Replaces static strings with translation keys in UI elements.
src/components/Dialog/RemoveNodeDialog.tsx Applies internationalized text for dialogs & button labels.
src/components/Dialog/RefreshKeysDialog/RefreshKeysDialog.tsx Uses t() for dialog title, description, and button texts.
src/components/Dialog/RebootOTADialog.tsx Translation keys now govern title, description, placeholder, and button texts.
src/components/Dialog/RebootDialog.tsx Internationalizes dialog titles, button names, & descriptions.
src/components/Dialog/QRDialog.tsx Refactors QR dialog texts with translation functions.
src/components/Dialog/PkiRegenerateDialog.tsx Integrates translations for dialog text defaults.
src/components/Dialog/PKIBackupDialog.tsx Uses translation keys in print/download dialogs.
src/components/Dialog/NodeDetailsDialog/NodeDetailsDialog.tsx Applies i18n to labels, button texts, and descriptions.
src/components/Dialog/NewDeviceDialog.tsx Updates dialog title, tab labels, and error messages with translations.
src/components/Dialog/LocationResponseDialog.tsx Uses t() for location details and dialog title.
src/components/Dialog/ImportDialog.tsx Internationalizes error messages, labels, and button texts.
src/components/Dialog/DeviceNameDialog.tsx Refactors device name change dialog labels and buttons with translations.
src/components/Dialog/DeleteMessagesDialog/DeleteMessagesDialog.tsx Applies t() for title and button texts in message deletion dialog.
src/components/CommandPalette/index.tsx Uses translations for command group labels and button aria labels.
src/components/BatteryStatus.tsx Integrates translations for battery status texts and units.
package.json Adds new i18next dependencies and related packages.

@danditomaso danditomaso changed the title feat: added internationalization lib, added english label file i18n-next / add english labels file May 23, 2025
Copy link

vercel bot commented May 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
web-test ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 0:13am

@danditomaso danditomaso marked this pull request as draft May 23, 2025 01:43
@danditomaso danditomaso changed the title i18n-next / add english labels file i18n May 23, 2025
@Hunter275
Copy link
Member

I am so excited for this!

Copy link
Contributor

@philon- philon- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work!

My inline comments may be a little off - GitHub only allows comments on changed lines(?)

Also, for future reference it might be good to document how contributors should add new strings the proper way so that they get synced to Crowdin

@danditomaso danditomaso marked this pull request as ready for review May 23, 2025 17:06
@danditomaso danditomaso changed the title i18n Internationalization (i18n) May 23, 2025
@danditomaso
Copy link
Collaborator Author

Fantastic work!

My inline comments may be a little off - GitHub only allows comments on changed lines(?)

Also, for future reference it might be good to document how contributors should add new strings the proper way so that they get synced to Crowdin

Thanks for the detailed review. I had switched from using dots to underscores to break up long key names, but switched half way through and I guess I left some of the unmodified strings in place. I believe I've resolved most of your questions, though one of them wasnt clear and I was hoping for some clarification before I can respond.

Copy link
Contributor

@philon- philon- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@danditomaso danditomaso merged commit eb2a271 into meshtastic:main May 27, 2025
3 checks passed
@danditomaso danditomaso deleted the feat/i18n branch May 27, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Replacing static text / Multilanguage preparations
3 participants