Internationalization (i18n) (#627)

* `feat: added internationalization lib, added english labels`
* `fixes from code review`
* `feat: add crowdin github actions`
* `fix: added support for i18n in testing. Fixed broken tests`
* `fix: missing translations`
* `removed unneded import`
* `more components updated with missing translations`
* `fixed lint issue`
* `Refactor: updated how translations are scoped, updated all references`
* `fixing broken tests`
* `feat: added language switcher, updated some translations`
* `fixed linting issues`
* `reverting vite config`
* `add english group id's to command palette`
* `updated PR template for i18n`
This commit is contained in:
Dan Ditomaso
2025-05-27 08:33:43 -04:00
committed by GitHub
parent 9d74fe2d6e
commit eb2a2717b1
95 changed files with 4651 additions and 1497 deletions
@@ -5,6 +5,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx";
import { useDevice } from "@core/stores/deviceStore.ts";
import { Protobuf } from "@meshtastic/core";
import { useState } from "react";
import { useTranslation } from "react-i18next";
export const Bluetooth = () => {
const { config, setWorkingConfig } = useDevice();
@@ -16,6 +17,7 @@ export const Bluetooth = () => {
removeError,
clearErrors,
} = useAppStore();
const { t } = useTranslation("deviceConfig");
const [bluetoothPin, setBluetoothPin] = useState(
config?.bluetooth?.fixedPin.toString() ?? "",
@@ -24,7 +26,7 @@ export const Bluetooth = () => {
const validateBluetoothPin = (pin: string) => {
// if empty show error they need a pin set
if (pin === "") {
return addError("fixedPin", "Bluetooth Pin is required");
return addError("fixedPin", t("bluetooth.validation.pinRequired"));
}
// clear any existing errors
@@ -32,11 +34,14 @@ export const Bluetooth = () => {
// if it starts with 0 show error
if (pin[0] === "0") {
return addError("fixedPin", "Bluetooth Pin cannot start with 0");
return addError(
"fixedPin",
t("bluetooth.validation.pinCannotStartWithZero"),
);
}
// if it's not 6 digits show error
if (pin.length < 6) {
return addError("fixedPin", "Pin must be 6 digits");
return addError("fixedPin", t("bluetooth.validation.pinMustBeSixDigits"));
}
removeError("fixedPin");
@@ -69,22 +74,21 @@ export const Bluetooth = () => {
defaultValues={config.bluetooth}
fieldGroups={[
{
label: "Bluetooth Settings",
description: "Settings for the Bluetooth module ",
notes:
"Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.",
label: t("bluetooth.title"),
description: t("bluetooth.description"),
notes: t("bluetooth.note"),
fields: [
{
type: "toggle",
name: "enabled",
label: "Enabled",
description: "Enable or disable Bluetooth",
label: t("bluetooth.enabled.label"),
description: t("bluetooth.enabled.description"),
},
{
type: "select",
name: "mode",
label: "Pairing mode",
description: "Pin selection behaviour.",
label: t("bluetooth.pairingMode.label"),
description: t("bluetooth.pairingMode.description"),
selectChange: (e) => {
if (e !== "1") {
setBluetoothPin("");
@@ -104,8 +108,8 @@ export const Bluetooth = () => {
{
type: "number",
name: "fixedPin",
label: "Pin",
description: "Pin to use when pairing",
label: t("bluetooth.pin.label"),
description: t("bluetooth.pin.description"),
validationText: hasFieldError("fixedPin")
? getErrorMessage("fixedPin")
: "",