mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-22 18:13:28 +07:00
fix: Translation minor performance improvement.
This commit is contained in:
parent
e87538940c
commit
79144f4168
@ -2,6 +2,8 @@ import { createContext } from "react";
|
|||||||
import LocaleTranslations from "../locales/LocaleTranslations";
|
import LocaleTranslations from "../locales/LocaleTranslations";
|
||||||
const fs = window.require("fs");
|
const fs = window.require("fs");
|
||||||
|
|
||||||
|
const electronSettings = window.require("electron-settings");
|
||||||
|
|
||||||
const LocaleContext = createContext({
|
const LocaleContext = createContext({
|
||||||
is: "en",
|
is: "en",
|
||||||
change: (to: AvailableLanguages): void => {},
|
change: (to: AvailableLanguages): void => {},
|
||||||
@ -71,7 +73,6 @@ function addKeyToLocale(_id: string, _currentLocale: string, _fallback: string |
|
|||||||
* @param variables Variables to replace in the sentence
|
* @param variables Variables to replace in the sentence
|
||||||
*/
|
*/
|
||||||
function getTranslation(id: string, fallback?: string, variables?: Record<string, string>): string {
|
function getTranslation(id: string, fallback?: string, variables?: Record<string, string>): string {
|
||||||
const electronSettings = window.require("electron-settings");
|
|
||||||
const currentLocale = electronSettings.get("locale") ? (electronSettings.get("locale") as AvailableLanguages) : "en";
|
const currentLocale = electronSettings.get("locale") ? (electronSettings.get("locale") as AvailableLanguages) : "en";
|
||||||
var sentence: string | undefined = LocaleTranslations[currentLocale][id];
|
var sentence: string | undefined = LocaleTranslations[currentLocale][id];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user