fix: add missing readBooks translations
Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Has been cancelled
Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Has been cancelled
This commit is contained in:
46
scripts/simple-translation-fix.js
Normal file
46
scripts/simple-translation-fix.js
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env node
|
||||
require('dotenv').config();
|
||||
const DIRECTUS_URL = process.env.DIRECTUS_URL || 'https://cms.dk0.dev';
|
||||
const DIRECTUS_TOKEN = process.env.DIRECTUS_STATIC_TOKEN;
|
||||
|
||||
async function api(endpoint, method = 'PATCH', body = null) {
|
||||
const res = await fetch(`${DIRECTUS_URL}/${endpoint}`, {
|
||||
method,
|
||||
headers: { 'Authorization': `Bearer ${DIRECTUS_TOKEN}`, 'Content-Type': 'application/json' },
|
||||
body: body ? JSON.stringify(body) : null
|
||||
});
|
||||
return res.ok ? await res.json() : { error: true };
|
||||
}
|
||||
|
||||
async function simpleFix() {
|
||||
console.log('🛠 Vereinfache Übersetzungs-Interface...');
|
||||
|
||||
// 1. Das Hauptfeld "translations" konfigurieren
|
||||
await api('fields/book_reviews/translations', 'PATCH', {
|
||||
meta: {
|
||||
interface: 'translations',
|
||||
options: {
|
||||
languageField: 'languages_code',
|
||||
userLanguage: false, // Deaktivieren, um Fehler zu vermeiden
|
||||
defaultLanguage: null
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 2. Das Sprachfeld in der Untertabelle konfigurieren
|
||||
await api('fields/book_reviews_translations/languages_code', 'PATCH', {
|
||||
meta: {
|
||||
interface: 'select-dropdown',
|
||||
options: {
|
||||
choices: [
|
||||
{ text: 'Deutsch', value: 'de-DE' },
|
||||
{ text: 'English', value: 'en-US' }
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log('✅ Fertig! Bitte lade Directus neu.');
|
||||
}
|
||||
|
||||
simpleFix().catch(console.error);
|
||||
Reference in New Issue
Block a user