[ISSUE #330] Format code and update the doc (#334)

This commit is contained in:
Crazylychee
2025-07-05 20:50:36 +08:00
committed by GitHub
parent 706082c62f
commit ff73529a75
85 changed files with 1012 additions and 906 deletions

View File

@@ -15,20 +15,21 @@
* limitations under the License.
*/
import React, { createContext, useState, useContext } from 'react';
import { translations } from '../i18n';
import React, {createContext, useContext, useState} from 'react';
import {translations} from '../i18n';
const LanguageContext = createContext({
lang: 'en',
setLang: () => {},
setLang: () => {
},
t: translations['en'], // 当前语言的文本资源
});
export const LanguageProvider = ({ children }) => {
export const LanguageProvider = ({children}) => {
const [lang, setLang] = useState('en');
const t = translations[lang] || translations['en'];
return (
<LanguageContext.Provider value={{ lang, setLang, t }}>
<LanguageContext.Provider value={{lang, setLang, t}}>
{children}
</LanguageContext.Provider>
);