fix: create stringService

This commit is contained in:
cihatata authored and cihat committed 2025-02-11 07:43:38 +03:00
1 parent e18f1d9b85
commit 6fc0e31743
10 files changed
+760 -86

No files matched your search

+4 -2
View File
@@ -1,7 +1,9 @@
const languageMiddleware = (req, res, next) => {
const languageMiddleware = (stringService, translationService) => (req, res, next) => {
const acceptLanguage = req.headers['accept-language'] || 'en';
const language = acceptLanguage.split(',')[0].slice(0, 2).toLowerCase();
req.language = acceptLanguage.split(',')[0].slice(0, 2).toLowerCase();
translationService.setLanguage(language);
stringService.setLanguage(language);
next();
};