Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
obra committed Nov 25, 2024
1 parent 9249cd7 commit ab17353
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 49 deletions.
14 changes: 7 additions & 7 deletions src/api/focus/keymap/language_maps.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// This file is auto-generated. Do not edit manually.
export const languageMaps = {
"de": require("./cldr_languages/de.json"),
"en": require("./cldr_languages/en.json"),
"es": require("./cldr_languages/es.json"),
"fr": require("./cldr_languages/fr.json"),
"id": require("./cldr_languages/id.json"),
de: require("./cldr_languages/de.json"),
en: require("./cldr_languages/en.json"),
es: require("./cldr_languages/es.json"),
fr: require("./cldr_languages/fr.json"),
id: require("./cldr_languages/id.json"),
"nb-NO": require("./cldr_languages/nb_no.json"),
"nl": require("./cldr_languages/nl.json"),
"zh-Hans": require("./cldr_languages/zh_hans.json")
nl: require("./cldr_languages/nl.json"),
"zh-Hans": require("./cldr_languages/zh_hans.json"),
};
5 changes: 2 additions & 3 deletions src/api/hardware-keyboardio-preonic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { flash, flashers } from "@api/flash";

import Keymap from "./components/Keymap";


const Preonic = {
info: {
vendor: "Keyboardio",
Expand All @@ -42,10 +41,10 @@ const Preonic = {
},
usb: {
vendorId: 0x3496,
productId: 0x00A0,
productId: 0x00a0,
bootloader: {
vendorId: 0x3496,
productId: 0x00A1,
productId: 0x00a1,
protocol: "nrfdfu",
},
},
Expand Down
44 changes: 21 additions & 23 deletions src/renderer/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,47 @@ import i18n from "i18next";
import { initReactI18next } from "react-i18next";

const resources = {
"de": {
de: {
messages: de,
},
"en": {
en: {
messages: en,
},
"es": {
es: {
messages: es,
},
"fr": {
fr: {
messages: fr,
},
"id": {
id: {
messages: id,
},
"nb-NO": {
messages: nb_NO,
},
"nl": {
nl: {
messages: nl,
},
"zh-Hans": {
messages: zh_Hans,
},
};

i18n
.use(initReactI18next)
.init({
react: {
useSuspense: true,
},
resources: resources,
lng: "en",
keySeparator: ".",
ns: ["messages"],
returnEmptyString: true,
defaultNS: "messages",
fallbackLng: "en",
interpolation: {
escapeValue: false,
},
});
i18n.use(initReactI18next).init({
react: {
useSuspense: true,
},
resources: resources,
lng: "en",
keySeparator: ".",
ns: ["messages"],
returnEmptyString: true,
defaultNS: "messages",
fallbackLng: "en",
interpolation: {
escapeValue: false,
},
});

i18n.refreshHardware = (device) => {
Object.keys(i18n.options.resources).forEach((code) => {
Expand Down
34 changes: 18 additions & 16 deletions src/renderer/screens/Preferences/ui/LookAndFeelPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,24 @@ function LookAndFeelPreferences(props) {
}
};

const languages = Object.keys(i18n.options.resources).map((code) => {
// Check if this specific language has the translation
const translation = i18n.t("this_translation_language", {
lng: code,
fallbackLng: [], // Empty array means no fallback for just this translation
});

// If we got back the translation key, it means translation is missing
if (translation === "this_translation_language") return null;

return (
<MenuItem value={code} key={code}>
{translation}
</MenuItem>
);
}).filter(Boolean);
const languages = Object.keys(i18n.options.resources)
.map((code) => {
// Check if this specific language has the translation
const translation = i18n.t("this_translation_language", {
lng: code,
fallbackLng: [], // Empty array means no fallback for just this translation
});

// If we got back the translation key, it means translation is missing
if (translation === "this_translation_language") return null;

return (
<MenuItem value={code} key={code}>
{translation}
</MenuItem>
);
})
.filter(Boolean);

const systemSvg = (
<svg width="120" height="73" viewBox="0 0 120 73" fill="none" xmlns="https://www.w3.org/2000/svg">
Expand Down

0 comments on commit ab17353

Please sign in to comment.