Skip to content
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

Chore/multi language fixes #180

Merged
merged 5 commits into from
Jul 22, 2024
Merged

Chore/multi language fixes #180

merged 5 commits into from
Jul 22, 2024

Conversation

nomadbitcoin
Copy link
Contributor

@nomadbitcoin nomadbitcoin commented Jul 17, 2024

This PR includes several key updates and fixes to improve multi-language support and functionality.

  • Standardized language support for Brazilian Portuguese.
  • Ensured content loads correctly based on the selected language and updated the URL path accordingly.
  • Refactor code to use GetPage within getServerSideProps for better performance.
  • Update page path url to include Section number.

Closes #179

Copy link

vercel bot commented Jul 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
web3-bootcamp-platform ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2024 2:01pm

next.config.js Outdated
@@ -1,6 +1,6 @@
module.exports = {
i18n: {
locales: ['en', 'pt'],
locales: ['en', 'pt_BR'],
Copy link
Contributor

Choose a reason for hiding this comment

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

The correct is pt-BR (with hiphen)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll update that in the https://github.com/w3b3d3v/buildspace-projects as well

lessonsSubmitted.map((item) => {
if (item?.lesson === lesson && item?.user == user?.uid && item?.cohort_id == cohort?.id) {
lessonsSubmitted.forEach((item) => {
console.log('lesson', lesson)
Copy link
Contributor

Choose a reason for hiding this comment

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

Left over

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🙈


useEffect(() => {
lessonsSubmitted.map((item) => {
if (item?.lesson === lesson && item?.user == user?.uid && item?.cohort_id == cohort?.id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you remove this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the previous code, "lessonsSubmitted" included all users' lessons from other courses and cohorts. However, my solution only fetches the lessons for the current course and cohort directly in the database query, eliminating the need for additional checks.

const nextLesson = () => {
const currentLessonIndex = sortedLessons.map((item) => item.lesson === lesson).indexOf(true)
const currentLessonIndex = sortedLessons.findIndex((item) => item.lesson === lesson)
Copy link
Contributor

Choose a reason for hiding this comment

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

😍


useEffect(() => {
setSortedLessons(course.lessons.sort((a, b) => (a.section > b.section ? 1 : -1)))
}, [sortedLessons])

useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This code should not be here. It is a generic language change code that should be in the page template or navbar component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed 😉

@danicuki danicuki merged commit 0d3ede2 into main Jul 22, 2024
3 of 5 checks passed
@danicuki danicuki deleted the chore/multi-language-fixes branch July 22, 2024 15:32
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.

Multi-language Fixes and Improvements
2 participants