Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/contexts/LocalizationContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// src/contexts/LocalizationContext.tsx
import React, { createContext, useContext, useState, useEffect, type ReactNode } from 'react';

Check warning on line 2 in src/contexts/LocalizationContext.tsx

View workflow job for this annotation

GitHub Actions / build

'useEffect' is defined but never used. Allowed unused vars must match /^_/u
import localizationData from '../localization.json';
import localizationInfo from '../localization-info.json';
import caseData1_7 from '../localization-case_1-7.json';
Expand Down Expand Up @@ -51,14 +51,13 @@

// 번역 함수
const t = (key: LocalizationKey): string => {
const translation = allLocalizationData[key];
const translation = allLocalizationData[key] as Record<Language, string>;
if (!translation) {
console.warn(`Translation key "${key}" not found`);
return key;
}
return translation[language] || translation['KO'] || key;
};

return (
<LocalizationContext.Provider value={{ language, setLanguage, t }}>
{children}
Expand All @@ -67,7 +66,7 @@
};

// 커스텀 훅
export const useLocalization = () => {

Check failure on line 69 in src/contexts/LocalizationContext.tsx

View workflow job for this annotation

GitHub Actions / build

Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components
const context = useContext(LocalizationContext);
if (!context) {
throw new Error('useLocalization must be used within LocalizationProvider');
Expand Down
Loading