Added service/translation.js -> Implements a translation service that dynamically loads phrases based on user language preference.

This commit is contained in:
K
2025-06-19 16:20:32 +05:30
parent 64a34fdf0d
commit c123c4985c
+9
View File
@@ -0,0 +1,9 @@
// src/service/translation.js
import en from '../locales/en.json';
import fr from '../locales/fr.json';
const translations = { en, fr };
export const t = (key, lang = 'en') => {
return translations[lang][key] || key; // Fallback to key if missing
};