mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-22 10:03: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";
|
||||
const fs = window.require("fs");
|
||||
|
||||
const electronSettings = window.require("electron-settings");
|
||||
|
||||
const LocaleContext = createContext({
|
||||
is: "en",
|
||||
change: (to: AvailableLanguages): void => {},
|
||||
@ -71,7 +73,6 @@ function addKeyToLocale(_id: string, _currentLocale: string, _fallback: string |
|
||||
* @param variables Variables to replace in the sentence
|
||||
*/
|
||||
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";
|
||||
var sentence: string | undefined = LocaleTranslations[currentLocale][id];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user