mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +01:00
chore(web): add prettier and format
This commit is contained in:
@@ -1,40 +1,26 @@
|
||||
import { Context, createContext, useContext, useState } from "react";
|
||||
import { useNuiEvent } from "../hooks/useNuiEvent";
|
||||
import { debugData } from "../utils/debugData";
|
||||
import { Context, createContext, useContext, useState } from 'react';
|
||||
import { useNuiEvent } from '../hooks/useNuiEvent';
|
||||
import { debugData } from '../utils/debugData';
|
||||
|
||||
debugData([
|
||||
{
|
||||
action: "loadLocales",
|
||||
data: [
|
||||
"en",
|
||||
"fr",
|
||||
"de",
|
||||
"it",
|
||||
"es",
|
||||
"pt-BR",
|
||||
"pl",
|
||||
"ru",
|
||||
"ko",
|
||||
"zh-TW",
|
||||
"ja",
|
||||
"es-MX",
|
||||
"zh-CN",
|
||||
],
|
||||
action: 'loadLocales',
|
||||
data: ['en', 'fr', 'de', 'it', 'es', 'pt-BR', 'pl', 'ru', 'ko', 'zh-TW', 'ja', 'es-MX', 'zh-CN'],
|
||||
},
|
||||
]);
|
||||
|
||||
debugData([
|
||||
{
|
||||
action: "setLocale",
|
||||
action: 'setLocale',
|
||||
data: {
|
||||
language: "English",
|
||||
language: 'English',
|
||||
ui: {
|
||||
settings: {
|
||||
title: "Settings",
|
||||
language: "Language",
|
||||
title: 'Settings',
|
||||
language: 'Language',
|
||||
},
|
||||
close: "Close",
|
||||
confirm: "Confirm",
|
||||
close: 'Close',
|
||||
confirm: 'Confirm',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -62,28 +48,23 @@ const LocaleCtx = createContext<LocaleContextValue | null>(null);
|
||||
|
||||
const LocaleProvider: React.FC = ({ children }) => {
|
||||
const [locale, setLocale] = useState<Locale>({
|
||||
language: "",
|
||||
language: '',
|
||||
ui: {
|
||||
settings: {
|
||||
title: "",
|
||||
language: "",
|
||||
title: '',
|
||||
language: '',
|
||||
},
|
||||
cancel: "",
|
||||
close: "",
|
||||
confirm: "",
|
||||
cancel: '',
|
||||
close: '',
|
||||
confirm: '',
|
||||
},
|
||||
});
|
||||
|
||||
useNuiEvent("setLocale", async (data: Locale) => setLocale(data));
|
||||
useNuiEvent('setLocale', async (data: Locale) => setLocale(data));
|
||||
|
||||
return (
|
||||
<LocaleCtx.Provider value={{ locale, setLocale }}>
|
||||
{children}
|
||||
</LocaleCtx.Provider>
|
||||
);
|
||||
return <LocaleCtx.Provider value={{ locale, setLocale }}>{children}</LocaleCtx.Provider>;
|
||||
};
|
||||
|
||||
export default LocaleProvider;
|
||||
|
||||
export const useLocales = () =>
|
||||
useContext<LocaleContextValue>(LocaleCtx as Context<LocaleContextValue>);
|
||||
export const useLocales = () => useContext<LocaleContextValue>(LocaleCtx as Context<LocaleContextValue>);
|
||||
|
||||
Reference in New Issue
Block a user