feat: Refine i18n content across multiple locales and improve LLM SEO data processing for catalog generation.

This commit is contained in:
sebseb7
2025-12-14 09:47:51 +01:00
parent 9df5642a6e
commit 57515bfb85
49 changed files with 528 additions and 479 deletions

View File

@@ -260,7 +260,7 @@ const generateCategoryProductList = (category, categoryProducts = []) => {
const fileName = `llms-${categorySlug}-list.txt`;
const subcategoryIds = (category.subcategories || []).join(',');
let content = `${String(category.name)},${String(category.id)},[${subcategoryIds}]\n`;
let content = '';//`${String(category.name)},${String(category.id)},[${subcategoryIds}]\n`;
categoryProducts.forEach((product) => {
const artnr = String(product.articleNumber || '');

View File

@@ -1,9 +1,10 @@
const fs = require('fs');
const path = require('path');
// Read the input file
const inputFile = path.join(__dirname, 'dist', 'llms-cat.txt');
const outputFile = path.join(__dirname, 'output.csv');
// Read the input file from public
const inputFile = path.join(__dirname, 'public', 'llms-cat.txt');
// Write the output file to dist
const outputFile = path.join(__dirname, 'dist', 'llms-cat.txt');
// Function to parse a CSV line with escaped quotes
function parseCSVLine(line) {
@@ -38,44 +39,65 @@ function parseCSVLine(line) {
}
try {
if (!fs.existsSync(inputFile)) {
throw new Error(`Input file not found: ${inputFile}`);
}
const data = fs.readFileSync(inputFile, 'utf8');
const lines = data.trim().split('\n');
const outputLines = ['URL,SEO Description'];
// Keep the header as intended: URL and Description
const outputLines = ['URL of product list for article numbers,SEO Description'];
for (const line of lines) {
let skippedLines = 0;
let processedLines = 0;
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if (line.trim() === '') continue;
// Skip comment lines or lines not starting with a number/quote (simple heuristic for header/comments)
// The file starts with text "this file has..." and then header "categoryId..."
// Actual data lines start with "
if (!line.trim().startsWith('"')) {
continue;
}
// Parse the CSV line properly handling escaped quotes
const fields = parseCSVLine(line);
if (fields.length !== 3) {
console.warn(`Skipping malformed line (got ${fields.length} fields): ${line.substring(0, 100)}...`);
console.warn(`Skipping malformed line ${i + 1} (got ${fields.length} fields): ${line.substring(0, 50)}...`);
skippedLines++;
continue;
}
const [field1, field2, field3] = fields;
const url = field2;
// Input: categoryId, listFileName, seoDescription
// Output: URL, SEO Description
const [categoryId, listFileName, seoDescription] = fields;
// field3 is a JSON string - parse it directly
let seoDescription = '';
try {
const parsed = JSON.parse(field3);
seoDescription = parsed.seo_description || '';
} catch (e) {
console.warn(`Failed to parse JSON for URL ${url}: ${e.message}`);
console.warn(`JSON string: ${field3.substring(0, 200)}...`);
}
// Use listFileName as URL
const url = listFileName;
// Escape quotes for CSV output - URL doesn't need quotes, description does
const escapedDescription = '"' + seoDescription.replace(/"/g, '""') + '"';
// Use seoDescription as description directly (it's already a string)
const description = seoDescription;
// Escape quotes for CSV output
const escapedDescription = '"' + description.replace(/"/g, '""') + '"';
outputLines.push(`${url},${escapedDescription}`);
processedLines++;
}
// Ensure dist directory exists
const distDir = path.dirname(outputFile);
if (!fs.existsSync(distDir)) {
fs.mkdirSync(distDir, { recursive: true });
}
// Write the output CSV
fs.writeFileSync(outputFile, outputLines.join('\n'), 'utf8');
console.log(`Processed ${lines.length} lines and created ${outputFile}`);
console.log(`Processed ${processedLines} lines (skipped ${skippedLines}) and created ${outputFile}`);
} catch (error) {
console.error('Error processing file:', error.message);

View File

@@ -1,3 +1,5 @@
this file has the list of category overview lists, where you can find article numbers
categoryId,listFileName,seoDescription
"703","https://growheads.de/llms-abluft-sets-list.txt","Abluft-Sets für Growbox & Indoor-Grow: leise, energiesparend & mit Aktivkohlefilter zur Geruchsneutralisation. Ideal für Zelte von 60 cm bis 1 m²."
"317","https://growheads.de/llms-air-pot-list.txt","Air-Pot Pflanztöpfe für maximales Wurzelwachstum: Air-Pruning, optimale Belüftung & Drainage. Ideal für Indoor, Outdoor, Hydroponik & Anzucht."

View File

@@ -206,9 +206,11 @@ class Content extends Component {
componentDidMount() {
const currentLanguage = this.props.i18n?.language || 'de';
if(this.props.params.categoryId) {this.setState({loaded: false, unfilteredProducts: [], filteredProducts: [], attributes: [], categoryName: null, childCategories: [], lastFetchedLanguage: currentLanguage}, () => {
if (this.props.params.categoryId) {
this.setState({ loaded: false, unfilteredProducts: [], filteredProducts: [], attributes: [], categoryName: null, childCategories: [], lastFetchedLanguage: currentLanguage }, () => {
this.fetchCategoryData(this.props.params.categoryId);
})}
})
}
else if (this.props.searchParams?.get('q')) {
this.setState({ loaded: false, unfilteredProducts: [], filteredProducts: [], attributes: [], categoryName: null, childCategories: [], lastFetchedLanguage: currentLanguage }, () => {
this.fetchSearchData(this.props.searchParams?.get('q'));
@@ -698,7 +700,7 @@ class Content extends Component {
/>
</Box>
{(this.props.params.categoryId == 'Stecklinge' || this.props.params.categoryId == 'Seeds') &&
{(this.props.params.categoryId == 'Stecklinge___' || this.props.params.categoryId == 'Seeds___') &&
<Box sx={{ display: { xs: 'none', sm: 'block' } }}>
<Typography variant="h6" sx={{ mt: 3 }}>
{this.props.t ? this.props.t('navigation.otherCategories') : 'Andere Kategorien'}
@@ -767,7 +769,7 @@ class Content extends Component {
</Paper>
}
{this.props.params.categoryId == 'Seeds' && <Paper
{this.props.params.categoryId == 'Seeds___' && <Paper
component={Link}
to="/Kategorie/Stecklinge"
sx={{

View File

@@ -164,7 +164,7 @@ const MainPageLayout = () => {
const allContentBoxes = {
home: [
{ title: t('sections.seeds'), image: "/assets/images/seeds.avif", bgcolor: "#e1f0d3", link: "/Kategorie/Seeds" },
{ title: t('sections.stecklinge'), image: "/assets/images/cutlings.avif", bgcolor: "#e8f5d6", link: "/Kategorie/Stecklinge" }
{ title: t('sections.konfigurator'), image: "/assets/images/konfigurator.avif", bgcolor: "#e8f5d6", link: "/Konfigurator" }
],
aktionen: [
{ title: t('sections.oilPress'), image: "/assets/images/presse.jpg", bgcolor: "#e1f0d3", link: "/presseverleih" },

View File

@@ -1,11 +1,12 @@
export default {
"seeds": "بذور",
"stecklinge": "قصاصات",
"oilPress": "استعارة معصرة الزيت",
"konfigurator": "المُكوّن",
"oilPress": "استعارة مكبس الزيت",
"thcTest": "اختبار THC",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "ورينا أجمل صورة عندك",
"selectSeedRate": "اختار البذرة واضغط تقييم",
"indoorSeason": "موسم الزراعة الداخلية بدأ"
"address1": "شارع تراشينبرجر 14",
"address2": "01129 دريسدن",
"showUsPhoto": "اعرض لنا أجمل صورة لديك",
"selectSeedRate": "اختر البذرة، واضغط للتقييم",
"indoorSeason": "بدأ موسم الزراعة الداخلية"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "بذور وقصاصات القنب الممتازة",
"home": "بذور القنب الممتازة",
"aktionen": "العروض والتخفيضات الحالية",
"filiale": "متجرنا في دريسدن",
"filiale": "متجرنا في دريسدن"
};

View File

@@ -1,7 +1,8 @@
export default {
"seeds": "Семена",
"stecklinge": "Резници",
"oilPress": "Наеми преса за масло",
"konfigurator": "Конфигуратор",
"oilPress": "Наеми преса за олио",
"thcTest": "THC тест",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Фини семена и резници от канабис",
"home": "Качествени канабис семена",
"aktionen": "Текущи промоции и оферти",
"filiale": "Нашият магазин в Дрезден",
"filiale": "Нашият магазин в Дрезден"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Semena",
"stecklinge": "Řízky",
"konfigurator": "Konfigurátor",
"oilPress": "Půjčit lis na olej",
"thcTest": "THC test",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Kvalitní semena a řízky konopí",
"home": "Kvalitní semena konopí",
"aktionen": "Aktuální akce a nabídky",
"filiale": "Naše prodejna v Drážďanech",
"filiale": "Naše prodejna v Drážďanech"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Seeds",
"stecklinge": "Stecklinge",
"konfigurator": "Konfigurator",
"oilPress": "Ölpresse ausleihen",
"thcTest": "THC Test",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Fine Cannabis Seeds & Cuttings",
"home": "Fine Cannabis Seeds",
"aktionen": "Aktuelle Aktionen & Angebote",
"filiale": "Unsere Filiale in Dresden"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Σπόροι",
"stecklinge": "Μοσχεύματα",
"konfigurator": "Διαμορφωτής",
"oilPress": "Δανείσου πρέσα λαδιού",
"thcTest": "Τεστ THC",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Ποιοτικοί Σπόροι & Μοσχεύματα Κάνναβης",
"aktionen": "Τρέχουσες Προσφορές & Εκπτώσεις",
"filiale": "Το Κατάστημά μας στη Δρέσδη",
"home": "Ποιοτικοί Σπόροι Κάνναβης",
"aktionen": "Τρέχουσες προσφορές & εκπτώσεις",
"filiale": "Το κατάστημά μας στη Δρέσδη"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Seeds", // Seeds
"stecklinge": "Cuttings", // Stecklinge
"konfigurator": "Configurator", // Konfigurator
"oilPress": "Borrow oil press", // Ölpresse ausleihen
"thcTest": "THC test", // THC Test
"address1": "Trachenberger Straße 14", // Trachenberger Straße 14

View File

@@ -1,5 +1,5 @@
export default {
"home": "Fine Cannabis Seeds & Cuttings", // Fine Cannabis Samen & Stecklinge
"aktionen": "Current Promotions & Offers", // Aktuelle Aktionen & Angebote
"filiale": "Our Store in Dresden", // Unsere Filiale in Dresden
"home": "Fine Cannabis Seeds", // Fine Cannabis Seeds
"aktionen": "Current promotions & offers", // Aktuelle Aktionen & Angebote
"filiale": "Our store in Dresden" // Unsere Filiale in Dresden
};

View File

@@ -1,11 +1,12 @@
export default {
"seeds": "Semillas",
"stecklinge": "Esquejes",
"konfigurator": "Configurador",
"oilPress": "Pedir prestada prensa de aceite",
"thcTest": "Prueba de THC",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "Muéstranos tu foto más hermosa",
"selectSeedRate": "Selecciona semilla, haz clic para valorar",
"selectSeedRate": "Selecciona semilla, haz clic en valorar",
"indoorSeason": "Comienza la temporada de interior"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "Semillas y esquejes de cannabis de calidad",
"home": "Semillas de Cannabis de Calidad",
"aktionen": "Promociones y ofertas actuales",
"filiale": "Nuestra tienda en Dresden",
"filiale": "Nuestra tienda en Dresden"
};

View File

@@ -1,11 +1,12 @@
export default {
"seeds": "Graines",
"stecklinge": "Boutures",
"oilPress": "Emprunter la presse à huile",
"konfigurator": "Configurateur",
"oilPress": "Emprunter une presse à huile",
"thcTest": "Test THC",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "Montre-nous ta plus belle photo",
"selectSeedRate": "Sélectionne une graine, clique pour noter",
"indoorSeason": "La saison en intérieur commence"
"indoorSeason": "La saison indoor commence"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "Graines et boutures de cannabis de qualité",
"aktionen": "Promotions et offres actuelles",
"filiale": "Notre magasin à Dresde",
"home": "Graines de cannabis de qualité",
"aktionen": "Promotions et offres en cours",
"filiale": "Notre magasin à Dresde"
};

View File

@@ -1,11 +1,12 @@
export default {
"seeds": "Sjemenke",
"stecklinge": "Reznice",
"konfigurator": "Konfigurator",
"oilPress": "Posudi prešu za ulje",
"thcTest": "THC test",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "Pokaži nam svoju najljepšu fotografiju",
"selectSeedRate": "Odaberi sjeme, klikni ocjenu",
"selectSeedRate": "Odaberi sjeme, klikni ocijeni",
"indoorSeason": "Počinje sezona uzgoja u zatvorenom"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "Kvalitetne sjemenke i reznice kanabisa",
"home": "Kvalitetne sjemenke kanabisa",
"aktionen": "Trenutne promocije i ponude",
"filiale": "Naša trgovina u Dresdenu",
"filiale": "Naša trgovina u Dresdenu"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Magok",
"stecklinge": "Cserepek",
"konfigurator": "Konfigurátor",
"oilPress": "Olajprés kölcsönzése",
"thcTest": "THC teszt",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Minőségi kannabisz magok és dugványok",
"aktionen": "Aktuális promóciók és ajánlatok",
"filiale": "Üzletünk Drezdában",
"home": "Minőségi kannabisz magok",
"aktionen": "Aktuális akciók és ajánlatok",
"filiale": "Üzletünk Drezdában"
};

View File

@@ -1,11 +1,12 @@
export default {
"seeds": "Semi",
"stecklinge": "Talee",
"oilPress": "Prendere in prestito la pressa per olio",
"konfigurator": "Configuratore",
"oilPress": "Noleggia pressa per olio",
"thcTest": "Test THC",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "Mostraci la tua foto più bella",
"selectSeedRate": "Seleziona il seme, clicca per valutare",
"indoorSeason": "Inizia la stagione indoor"
"indoorSeason": "La stagione indoor inizia"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "Semi e talee di cannabis di alta qualità",
"home": "Semi di Cannabis di Qualità",
"aktionen": "Promozioni e offerte attuali",
"filiale": "Il nostro negozio a Dresda",
"filiale": "Il nostro negozio a Dresda"
};

View File

@@ -1,11 +1,13 @@
export default {
"seeds": "Nasiona",
"stecklinge": "Sadzonki",
"konfigurator": "Konfigurator",
"oilPress": "Wypożycz prasę do oleju",
"thcTest": "Test THC",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "Pokaż nam swoje najpiękniejsze zdjęcie",
"selectSeedRate": "Wybierz nasiono, kliknij ocenę",
"indoorSeason": "Sezon indoor się zaczyna"
"indoorSeason": "Sezon indoorowy się zaczyna",
"locale": "pl"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "Dobre Nasiona i Szczepki Konopi",
"aktionen": "Aktualne Promocje i Oferty",
"filiale": "Nasz Sklep w Dreźnie",
"home": "Dobre nasiona konopi",
"aktionen": "Aktualne promocje i oferty",
"filiale": "Nasz sklep w Dreźnie"
};

View File

@@ -1,11 +1,12 @@
export default {
"seeds": "Semințe",
"stecklinge": "Butășe",
"konfigurator": "Configurator",
"oilPress": "Împrumută presa de ulei",
"thcTest": "Test THC",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "Arată-ne cea mai frumoasă fotografie a ta",
"selectSeedRate": "Selectează sămânța, apasă pentru evaluare",
"selectSeedRate": "Selectează sămânța, apasă evaluează",
"indoorSeason": "Sezonul indoor începe"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "Semințe și butași de cannabis de calitate",
"home": "Semințe fine de cannabis",
"aktionen": "Promoții și oferte curente",
"filiale": "Magazinul nostru din Dresda",
"filiale": "Magazinul nostru din Dresden"
};

View File

@@ -1,11 +1,12 @@
export default {
"seeds": "Семена",
"stecklinge": "Черенки",
"konfigurator": "Конфигуратор",
"oilPress": "Взять напрокат маслопресс",
"thcTest": "Тест на THC",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "Покажи нам свою самую красивую фотографию",
"selectSeedRate": "Выберите семя, нажмите оценить",
"selectSeedRate": "Выберите семена, нажмите оценить",
"indoorSeason": "Начинается сезон для выращивания в помещении"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "Качественные семена и черенки каннабиса",
"home": "Качественные семена каннабиса",
"aktionen": "Текущие акции и предложения",
"filiale": "Наш магазин в Дрездене",
"filiale": "Наш магазин в Дрездене"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Semienka",
"stecklinge": "Rezky",
"konfigurator": "Konfigurátor",
"oilPress": "Požičajte si lis na olej",
"thcTest": "THC test",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Kvalitné semená a odrezky konope",
"home": "Kvalitné semená konope",
"aktionen": "Aktuálne akcie a ponuky",
"filiale": "Naša predajňa v Drážďanoch",
"filiale": "Náš obchod v Drážďanoch"
};

View File

@@ -1,11 +1,12 @@
export default {
"seeds": "Semena",
"stecklinge": "Rezalci",
"oilPress": "Izposodi si stiskalnico za olje",
"konfigurator": "Konfigurator",
"oilPress": "Izposodi si stiskalnico olja",
"thcTest": "THC test",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "Pokaži nam svojo najlepšo fotografijo",
"selectSeedRate": "Izberi seme, klikni oceno",
"selectSeedRate": "Izberi seme, klikni oceni",
"indoorSeason": "Začne se sezona gojenja v zaprtih prostorih"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "Kakovostna semena in reznice konoplje",
"home": "Kakovostna semena konoplje",
"aktionen": "Trenutne promocije in ponudbe",
"filiale": "Naša trgovina v Dresdnu",
"filiale": "Naša trgovina v Dresdnu"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Farëra",
"stecklinge": "Përkëmbëza",
"konfigurator": "Konfiguruesi",
"oilPress": "Huazo shtypësin e vajit",
"thcTest": "Testi THC",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Farëra dhe Gjethe Kanabisi të Kualitetit të Lartë",
"aktionen": "Promocionet dhe Ofertat Aktualë",
"filiale": "Dyqani Ynë në Dresden",
"home": "Farëra të mira kanabisi",
"aktionen": "Promocionet dhe ofertat aktuale",
"filiale": "Dyqani ynë në Dresden"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Semena",
"stecklinge": "Reznice",
"konfigurator": "Konfigurator",
"oilPress": "Pozajmi prešu za ulje",
"thcTest": "THC test",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Kvalitetni seme i reznice kanabisa",
"home": "Kvalitetne semenke kanabisa",
"aktionen": "Trenutne promocije i ponude",
"filiale": "Naša prodavnica u Dresdenu",
"filiale": "Naša prodavnica u Dresdenu"
};

View File

@@ -1,11 +1,12 @@
export default {
"seeds": "Frön",
"stecklinge": "Sticklingar",
"konfigurator": "Konfigurator",
"oilPress": "Låna oljepress",
"thcTest": "THC-test",
"address1": "Trachenberger Straße 14",
"address2": "01129 Dresden",
"showUsPhoto": "Visa oss ditt vackraste foto",
"showUsPhoto": "Visa oss din vackraste bild",
"selectSeedRate": "Välj frö, klicka betyg",
"indoorSeason": "Inomhussäsongen börjar"
};

View File

@@ -1,5 +1,5 @@
export default {
"home": "Fina cannabisfrön & sticklingar",
"home": "Fina cannabisfrön",
"aktionen": "Aktuella kampanjer & erbjudanden",
"filiale": "Vår butik i Dresden",
"filiale": "Vår butik i Dresden"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Tohumlar",
"stecklinge": "Çelikler",
"konfigurator": "Konfigüratör",
"oilPress": "Yağ presini ödünç al",
"thcTest": "THC testi",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Kaliteli Kenevir Tohumları ve Çelikleri",
"aktionen": "Güncel Kampanyalar ve Teklifler",
"filiale": "Dresden'deki Mağazamız",
"home": "Kaliteli Kenevir Tohumları",
"aktionen": "Mevcut promosyonlar ve teklifler",
"filiale": "Dresden'deki mağazamız"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "Насіння",
"stecklinge": "Живці",
"konfigurator": "Конфігуратор",
"oilPress": "Позичити олійний прес",
"thcTest": "Тест на THC",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "Якісне насіння та живці канабісу",
"home": "Якісне насіння канабісу",
"aktionen": "Поточні акції та пропозиції",
"filiale": "Наш магазин у Дрездені",
"filiale": "Наш магазин у Дрездені"
};

View File

@@ -1,6 +1,7 @@
export default {
"seeds": "种子",
"stecklinge": "插枝",
"konfigurator": "配置器",
"oilPress": "借用榨油机",
"thcTest": "THC 测试",
"address1": "Trachenberger Straße 14",

View File

@@ -1,5 +1,5 @@
export default {
"home": "优质大麻种子和插枝",
"home": "优质大麻种子",
"aktionen": "当前促销与优惠",
"filiale": "我们在德累斯顿的门店",
"filiale": "我们在德累斯顿的门店"
};