From 87092c62c77a3ed23c90a86a746cb2630dd3db60 Mon Sep 17 00:00:00 2001 From: h1ghvoltage003 Date: Sat, 11 Oct 2025 01:04:27 +0530 Subject: [PATCH 1/3] Added localization support for year progress bar --- api/app.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/api/app.js b/api/app.js index 9cef51c..ad62190 100644 --- a/api/app.js +++ b/api/app.js @@ -12,6 +12,9 @@ app.get("/year-progress", (req, res) => { const startDateParam = req.query.startDate; const endDateParam = req.query.endDate; + const lang = req.query.lang || "en"; + + let start = startDateParam ? new Date(startDateParam) : new Date(now.getFullYear(), 0, 1); @@ -29,14 +32,24 @@ app.get("/year-progress", (req, res) => { const progress = ((now - start) / (end - start)) * 100; const progressFormatted = progress.toFixed(6); - const displayText = currentYear; + + + const translations = { + en: `Completed`, + es: `Completado`, + fr: `Terminé`, + de: `Abgeschlossen`, + hi: `पूरा हुआ`, + }; + + const localizedText = `${progressFormatted}% of ${currentYear} ${translations[lang] || translations["en"]}`; const svg = ` - ${progressFormatted}% of ${displayText} Completed + ${localizedText} `; @@ -50,4 +63,9 @@ app.get("/", (req, res) => { res.sendFile(path.join(__dirname, "..", "public", "index.html")); }); +const PORT = 3000; +app.listen(PORT, () => { + console.log(`Server running at http://localhost:${PORT}`); +}); + module.exports = app; From 5f7b89efe03250d399235d189f8f602557626179 Mon Sep 17 00:00:00 2001 From: h1ghvoltage003 Date: Sat, 11 Oct 2025 01:13:20 +0530 Subject: [PATCH 2/3] Added language dropdown and localization feature --- package-lock.json | 28 ++++++++++++++++------------ package.json | 4 ++-- public/index.html | 44 ++++++++++++++++++++++++++++++++++++++------ 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index ce55770..76bffbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "express": "^4.21.0" + "express": "^4.21.2" } }, "node_modules/accepts": { @@ -104,9 +104,9 @@ } }, "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -215,9 +215,9 @@ } }, "node_modules/express": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz", - "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "license": "MIT", "dependencies": { "accepts": "~1.3.8", @@ -225,7 +225,7 @@ "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -239,7 +239,7 @@ "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.10", + "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", "qs": "6.13.0", "range-parser": "~1.2.1", @@ -254,6 +254,10 @@ }, "engines": { "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/finalhandler": { @@ -532,9 +536,9 @@ } }, "node_modules/path-to-regexp": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", - "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "license": "MIT" }, "node_modules/proxy-addr": { diff --git a/package.json b/package.json index f3c6071..d71c990 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,6 @@ "author": "", "license": "ISC", "dependencies": { - "express": "^4.21.0" + "express": "^4.21.2" } -} \ No newline at end of file +} diff --git a/public/index.html b/public/index.html index 534eb2e..b82a21f 100644 --- a/public/index.html +++ b/public/index.html @@ -28,10 +28,40 @@ -

Year Progress

+

Year Progress

+ +
+ + +
+ + + + Year Progress @@ -114,6 +144,7 @@

const githubIcon = document.querySelector(".github-icon"); const body = document.body; var queryString; + function isDayTime() { const now = new Date(); const hours = now.getHours(); @@ -142,11 +173,11 @@

if (queryString) { document.getElementById( "progress-img" - ).src = `https://year-in-progress.vercel.app/year-progress?${queryString}&time=${Date.now()}&theme=${theme}`; + ).src = `http://localhost:3000/year-progress?${queryString}&time=${Date.now()}&theme=${theme}`; } else { document.getElementById( "progress-img" - ).src = `https://year-in-progress.vercel.app/year-progress?time=${Date.now()}&theme=${theme}`; + ).src = `http://localhost:3000/year-progress?time=${Date.now()}&theme=${theme}`; } } @@ -164,8 +195,9 @@

themeToggleButton.addEventListener("click", () => updateTheme(false)); - setInterval(updateProgressImg, 500); + // setInterval(updateProgressImg, 500); + // 3D Animation let scene, camera, renderer, cube; @@ -232,7 +264,7 @@

queryString = `startDate=${startDate}&endDate=${endDate}`; document.getElementById( "progress-img" - ).src = `https://year-in-progress.vercel.app/year-progress?${queryString}`; + ).src = `http://localhost:3000/year-progress?${queryString}`; } From c2e5d3c6c3ce9129c77a3a77b9788058490d8737 Mon Sep 17 00:00:00 2001 From: Dhanush Date: Mon, 13 Oct 2025 17:51:15 +0530 Subject: [PATCH 3/3] Update api/app.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- api/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/api/app.js b/api/app.js index ad62190..a89e8a7 100644 --- a/api/app.js +++ b/api/app.js @@ -14,7 +14,6 @@ app.get("/year-progress", (req, res) => { const lang = req.query.lang || "en"; - let start = startDateParam ? new Date(startDateParam) : new Date(now.getFullYear(), 0, 1);