From c123c4985cc9b9e726313bc9e4a59616f949ae72 Mon Sep 17 00:00:00 2001 From: Kshitij Date: Thu, 19 Jun 2025 16:20:32 +0530 Subject: [PATCH] Added service/translation.js -> Implements a translation service that dynamically loads phrases based on user language preference. --- Frontend/src/service/translation.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Frontend/src/service/translation.js diff --git a/Frontend/src/service/translation.js b/Frontend/src/service/translation.js new file mode 100644 index 0000000..52e7c7f --- /dev/null +++ b/Frontend/src/service/translation.js @@ -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 +};