[grade=pending] QA sprint: commit 103 at-risk files from multi-agent sprint work
Committed by Hermes autonomous QA sprint 2026-08-13. These files were modified during the Aug 12 sprint but never committed.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* DC-077: i18n route — serves translations and language metadata
|
||||
*/
|
||||
const express = require('express');
|
||||
const { ok } = require('../src/utils/responses');
|
||||
const i18n = require('../src/utilities/i18n');
|
||||
|
||||
module.exports = function() {
|
||||
const router = express.Router();
|
||||
|
||||
// GET /api/v1/i18n/languages — list supported languages
|
||||
router.get('/i18n/languages', (req, res) => {
|
||||
ok(res, {
|
||||
languages: i18n.getSupportedLanguages().map(code => ({
|
||||
code,
|
||||
name: {
|
||||
en: 'English',
|
||||
es: 'Español',
|
||||
fr: 'Français',
|
||||
de: 'Deutsch',
|
||||
ar: 'العربية',
|
||||
}[code] || code,
|
||||
rtl: code === 'ar',
|
||||
})),
|
||||
default: i18n.DEFAULT_LANGUAGE,
|
||||
});
|
||||
});
|
||||
|
||||
// GET /api/v1/i18n/translations/:lang — get all translations for a language
|
||||
router.get('/i18n/translations/:lang', (req, res) => {
|
||||
const lang = req.params.lang;
|
||||
if (!i18n.isSupported(lang)) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
error: `Unsupported language: ${lang}`,
|
||||
supported: i18n.getSupportedLanguages(),
|
||||
});
|
||||
}
|
||||
ok(res, { lang, translations: i18n.TRANSLATIONS[lang] || {} });
|
||||
});
|
||||
|
||||
return router;
|
||||
};
|
||||
Reference in New Issue
Block a user