feat: default locale Russian, geo determines language for other countries
- localization-svc: defaultLocale ru, resolveLocale only by geo - web-svc: DEFAULT_LOCALE ru, layout lang=ru, embeddedTranslations fallback ru - countryToLocale: default ru when no country or unknown country Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
27
services/localization-svc/src/index.ts
Normal file
27
services/localization-svc/src/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import localeRouter from './routes/locale.js';
|
||||
import translationsRouter from './routes/translations.js';
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(cors({ origin: true }));
|
||||
const PORT = parseInt(process.env.PORT ?? '3016', 10);
|
||||
|
||||
app.use(express.json({ limit: '1mb' }));
|
||||
|
||||
app.use('/api', localeRouter);
|
||||
app.use('/api', translationsRouter);
|
||||
|
||||
app.get('/health', (_, res) =>
|
||||
res.json({ status: 'ok', service: 'localization-svc' }),
|
||||
);
|
||||
app.get('/ready', (_, res) => res.json({ status: 'ready' }));
|
||||
|
||||
app.listen(PORT, '0.0.0.0', () => {
|
||||
console.log(`localization-svc listening on :${PORT}`);
|
||||
console.log(` Locale (GET): /api/locale`);
|
||||
console.log(` Locale (POST): /api/locale (with client data in body)`);
|
||||
console.log(` Translations: /api/translations/:locale`);
|
||||
console.log(` Supported locales: /api/locales`);
|
||||
});
|
||||
Reference in New Issue
Block a user