Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
philffm committed Nov 18, 2024
1 parent ddb9850 commit 5925d0b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 98 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ ai-summary-helper.zip
test.md
Archive.zip
chrome-extension/Archive 2.zip
*.zip
*.zip
.env
15 changes: 13 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,30 @@

async function loadContent(lang = 'en') {
try {
let translations;
if (lang === 'en') {
const response = await fetch('translations.json');
if (!response.ok) {
throw new Error('Failed to load default content');
}
const translations = await response.json();
data = translations.content; // Assign to the broader scoped variable
translations = await response.json();
data = translations.content;
} else {
const response = await fetch(`lang/${lang}.json`);
if (!response.ok) {
throw new Error(`Failed to load language file: ${lang}`);
}
data = await response.json();

// Check if aisummary exists, if not, load from en.json
if (!data.aisummary) {
const enResponse = await fetch('lang/en.json');
if (!enResponse.ok) {
throw new Error('Failed to load English language file for aisummary');
}
const enData = await enResponse.json();
data.aisummary = enData.aisummary;
}
}

document.getElementById('metaTitle').textContent = data.title;
Expand Down
95 changes: 0 additions & 95 deletions translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,101 +15,6 @@
"code": "de",
"name": "Deutsch",
"emoji": "🇩🇪"
},
{
"code": "fr",
"name": "Français",
"emoji": "🇫🇷"
},
{
"code": "it",
"name": "Italiano",
"emoji": "🇮🇹"
},
{
"code": "pt",
"name": "Português",
"emoji": "🇵🇹"
},
{
"code": "nl",
"name": "Nederlands",
"emoji": "🇳🇱"
},
{
"code": "ru",
"name": "Русский",
"emoji": "🇷🇺"
},
{
"code": "ua",
"name": "Українська",
"emoji": "🇺🇦"
},
{
"code": "pl",
"name": "Polski",
"emoji": "🇵🇱"
},
{
"code": "sv",
"name": "Svenska",
"emoji": "🇸🇪"
},
{
"code": "da",
"name": "Dansk",
"emoji": "🇩🇰"
},
{
"code": "jp",
"name": "日本語",
"emoji": "🇯🇵"
},
{
"code": "cn",
"name": "中文",
"emoji": "🇨🇳"
},
{
"code": "kr",
"name": "한국어",
"emoji": "🇰🇷"
},
{
"code": "hi",
"name": "हिंदी",
"emoji": "🇮🇳"
},
{
"code": "th",
"name": "ไทย",
"emoji": "🇹🇭"
},
{
"code": "ind-bahasa",
"name": "Indonesian",
"emoji": "🇮🇩"
},
{
"code": "ar",
"name": "العربية",
"emoji": "🇦🇪"
},
{
"code": "tr",
"name": "Türkçe",
"emoji": "🇹🇷"
},
{
"code": "bg",
"name": "Ъългарски",
"emoji": "🇧🇬"
},
{
"code": "ro",
"name": "Romanian",
"emoji": "🇷🇴"
}
],
"content": {
Expand Down

0 comments on commit 5925d0b

Please sign in to comment.