- Replace Vite + React Router with Next.js 15 App Router - Implement i18n with next-intl (URL-based: /de, /en, /sr) - Add SSR/SSG for all pages (48 static pages generated) - Setup Supabase SSR client for auth - Migrate all pages: Home, About, Portfolio, Blog, Contact, Login, Dashboard, Imprint, Privacy, Terms - Add Docker support with standalone output - Replace i18next with next-intl JSON translations - Use next/image for optimized images Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
/**
|
|
* Script to convert TypeScript translations to JSON for next-intl
|
|
* Run with: node scripts/convert-translations.js
|
|
*/
|
|
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const locales = ['de', 'en', 'sr'];
|
|
|
|
async function convertTranslations() {
|
|
for (const locale of locales) {
|
|
console.log(`Converting ${locale} translations...`);
|
|
|
|
try {
|
|
// Dynamically import the translations
|
|
const translations = await import(`../src/i18n/locales/${locale}/index.ts`);
|
|
const data = translations.default || translations;
|
|
|
|
// Output directory
|
|
const outputDir = path.join(__dirname, '..', 'src', 'messages');
|
|
if (!fs.existsSync(outputDir)) {
|
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
}
|
|
|
|
// Write JSON file
|
|
const outputPath = path.join(outputDir, `${locale}.json`);
|
|
fs.writeFileSync(outputPath, JSON.stringify(data, null, 2), 'utf-8');
|
|
|
|
console.log(` ✓ Saved to ${outputPath}`);
|
|
} catch (error) {
|
|
console.error(` ✗ Error converting ${locale}:`, error.message);
|
|
}
|
|
}
|
|
|
|
console.log('\nConversion complete!');
|
|
}
|
|
|
|
convertTranslations();
|