- Add intelligent content-game compatibility system with visual badges - Fix Adventure Reader to work with Dragon's Pearl content structure - Implement multi-column games grid for faster navigation - Add pronunciation display for Chinese vocabulary and sentences - Fix navigation breadcrumb to show proper hierarchy (Home > Levels > Content) - Add back buttons to all navigation pages - Improve JSONContentLoader to preserve story structure - Add comprehensive debugging and diagnostic tools 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
27 lines
987 B
JavaScript
27 lines
987 B
JavaScript
// Quick script to convert old vocabulary format to new language-agnostic format
|
||
const fs = require('fs');
|
||
|
||
function convertVocabularyFormat(inputFile, outputFile) {
|
||
let content = fs.readFileSync(inputFile, 'utf8');
|
||
|
||
// Pattern to match: word: "translation",
|
||
const pattern = /(\s+)(\w+|"[^"]*"): "([^"]*)",?/g;
|
||
|
||
content = content.replace(pattern, (match, indent, word, translation) => {
|
||
// Determine word type based on translation or word
|
||
let type = "noun"; // Default
|
||
if (translation.includes("的") && !translation.includes(";")) type = "adjective";
|
||
if (word.includes(" ")) type = "phrase";
|
||
|
||
return `${indent}${word}: { user_language: "${translation}", type: "${type}" },`;
|
||
});
|
||
|
||
fs.writeFileSync(outputFile, content);
|
||
console.log(`Converted ${inputFile} to ${outputFile}`);
|
||
}
|
||
|
||
// Convert the sbs file
|
||
convertVocabularyFormat(
|
||
'js/content/sbs-level-7-8-new.js',
|
||
'js/content/sbs-level-7-8-new-converted.js'
|
||
); |