Skip to content

Added language support for year progress bar#52

Open
dikshaaa316 wants to merge 4 commits into
DhanushNehru:mainfrom
dikshaaa316:feat/localization-lang
Open

Added language support for year progress bar#52
dikshaaa316 wants to merge 4 commits into
DhanushNehru:mainfrom
dikshaaa316:feat/localization-lang

Conversation

@dikshaaa316
Copy link
Copy Markdown

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 10, 2025

@dikshaaa316 is attempting to deploy a commit to the Dhanush Nehru's projects Team on Vercel.

A member of the Team first needs to authorize it.

@DhanushNehru
Copy link
Copy Markdown
Owner

Resolve merge conflict issues @dikshaaa316

@DhanushNehru DhanushNehru requested a review from Copilot October 11, 2025 06:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds internationalization support to the year progress bar application, allowing users to select from multiple languages (English, Spanish, French, German, Hindi) with localized display text.

  • Added language selection dropdown with 5 language options
  • Implemented client-side language switching functionality
  • Added server-side translation support for progress bar text

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
public/index.html Added language selector UI and JavaScript function to handle language changes
api/app.js Added translation dictionary and localization logic for progress bar text
package.json Updated Express version from 4.21.0 to 4.21.2

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread public/index.html
Comment on lines +57 to +64
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"
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded localhost URL should be configurable or use relative URLs for production deployment. Consider using a relative path like /year-progress?${qs}&time=${Date.now()} instead.

Copilot uses AI. Check for mistakes.
Comment thread public/index.html Outdated
Comment on lines +176 to +180
).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}`;
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded localhost URL should be configurable or use relative URLs for production deployment. Consider using a relative path like /year-progress?${queryString}&time=${Date.now()}&theme=${theme} instead.

Copilot uses AI. Check for mistakes.
Comment thread public/index.html Outdated
Comment on lines +176 to +180
).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}`;
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded localhost URL should be configurable or use relative URLs for production deployment. Consider using a relative path like /year-progress?time=${Date.now()}&theme=${theme} instead.

Copilot uses AI. Check for mistakes.
Comment thread public/index.html Outdated
document.getElementById(
"progress-img"
).src = `https://year-in-progress.vercel.app/year-progress?${queryString}`;
).src = `http://localhost:3000/year-progress?${queryString}`;
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded localhost URL should be configurable or use relative URLs for production deployment. Consider using a relative path like /year-progress?${queryString} instead.

Copilot uses AI. Check for mistakes.
Comment thread api/app.js
Comment on lines +38 to 46
en: `Completed`,
es: `Completado`,
fr: `Terminé`,
de: `Abgeschlossen`,
hi: `पूरा हुआ`,
};

const localizedText = `${progressFormatted}% of ${currentYear} ${translations[lang] || translations["en"]}`;

Copy link

Copilot AI Oct 11, 2025

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.

Suggested change
en: `Completed`,
es: `Completado`,
fr: `Terminé`,
de: `Abgeschlossen`,
hi: `पूरा हुआ`,
};
const localizedText = `${progressFormatted}% of ${currentYear} ${translations[lang] || translations["en"]}`;
en: {
template: "{progress}% of {year} Completed"
},
es: {
template: "{progress}% del {year} Completado"
},
fr: {
template: "{progress}% de {year} Terminé"
},
de: {
template: "{progress}% von {year} Abgeschlossen"
},
hi: {
template: "{year} का {progress}% पूरा हुआ"
}
};
function formatTemplate(template, values) {
return template.replace(/{(\w+)}/g, (_, key) => values[key] ?? "");
}
const template = (translations[lang]?.template) || translations["en"].template;
const localizedText = formatTemplate(template, {
progress: progressFormatted,
year: currentYear
});

Copilot uses AI. Check for mistakes.
@dikshaaa316
Copy link
Copy Markdown
Author

@DhanushNehru, merge conflicts are resolved.

@DhanushNehru DhanushNehru requested a review from Copilot October 13, 2025 12:02
@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
year-in-progress Ready Ready Preview Comment Oct 13, 2025 0:21am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread public/index.html
Comment on lines +58 to +65
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"
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded localhost URL will break in production. Consider using a relative URL or environment-based configuration.

Copilot uses AI. Check for mistakes.
Comment thread public/index.html
Comment on lines +58 to +65
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"
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded localhost URL will break in production. Consider using a relative URL like '/year-progress'.

Copilot uses AI. Check for mistakes.
Comment thread api/app.js Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DhanushNehru
Copy link
Copy Markdown
Owner

@dikshaaa316 do resolve the issues pointed by copilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants