-
Notifications
You must be signed in to change notification settings - Fork 17
Added language support for year progress bar #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,6 @@ | |
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "express": "^4.21.0" | ||
| "express": "^4.21.2" | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,10 +29,40 @@ | |
| </head> | ||
|
|
||
| <body> | ||
| <h1>Year Progress</h1> | ||
| <h1 id="title">Year Progress</h1> | ||
|
|
||
| <div style="text-align: center; margin: 1rem;"> | ||
| <label id="chooseLangLabel" for="language">Choose Language:</label> | ||
| <select id="language" onchange="changeLanguage()"> | ||
| <option value="en">English</option> | ||
| <option value="es">Spanish</option> | ||
| <option value="fr">French</option> | ||
| <option value="de">German</option> | ||
| <option value="hi">Hindi</option> | ||
| </select> | ||
| </div> | ||
|
|
||
| <script> | ||
| function changeLanguage() { | ||
| const lang = document.getElementById("language").value; | ||
| const img = document.getElementById("progress-img"); | ||
|
|
||
| let startDate = document.getElementById("startDate").value; | ||
| let endDate = document.getElementById("endDate").value; | ||
|
|
||
| // Build query string | ||
| let qs = `lang=${lang}`; | ||
| if (startDate) qs += `&startDate=${startDate}`; | ||
| if (endDate) qs += `&endDate=${endDate}`; | ||
|
|
||
| img.src = `http://localhost:3000/year-progress?${qs}&time=${Date.now()}`; | ||
| } | ||
| </script> | ||
|
|
||
|
|
||
| <img | ||
| id="progress-img" | ||
| src="https://year-in-progress.vercel.app/year-progress" | ||
| src="http://localhost:3000/year-progress" | ||
|
Comment on lines
+58
to
+65
|
||
| alt="Year Progress" | ||
| /> | ||
|
|
||
|
|
@@ -106,6 +136,7 @@ <h1 id="random-msg"></h1> | |
| integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" | ||
| crossorigin="anonymous" | ||
| ></script> | ||
|
|
||
| <script src="js/theme.js"></script> | ||
| <script src="js/animation.js"></script> | ||
| <script src="js/randomMsg.js"></script> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word order assumption may not work for all languages. Consider using a more flexible template system like
${progressFormatted}% ${translations[lang]?.template || translations.en.template}where each language can define its own sentence structure.