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

i18n Support Added #60

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

walleeva2018
Copy link

This PR solves the following Issue

What is Added

  • Localization is added to the website
  • User can switch between English & Bengali

File level changes

  • All the text are kept in 2 folder en-US.json and bn-BD.json (more language can be added easily)
  • Blog posts are also divided in 2 folder (more language can be added easily)
  • Nuxt i18n package is installed
  • And used $t for showing texts

Signed-off-by: zubairrafi <walleeva2018@gmail.com>
Signed-off-by: zubairrafi <walleeva2018@gmail.com>
Signed-off-by: zubairrafi <walleeva2018@gmail.com>
Signed-off-by: zubairrafi <walleeva2018@gmail.com>
Signed-off-by: zubairrafi <walleeva2018@gmail.com>
Copy link

vercel bot commented Jul 31, 2024

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

Name Status Preview Comments Updated (UTC)
blog ❌ Failed (Inspect) Aug 8, 2024 8:33pm

@nurRiyad
Copy link
Owner

nurRiyad commented Aug 1, 2024

First of all thanks for the PR. I have not gone through the code. From only seeing the UI my thoughts are

  • Need to update the language switching selectbox because it's huge and break the navbar in mobile view
  • If we are in a blogs details page like link and then changes the language it's gives use nuxt error. We need to handle it
  • We need to find a better way for blog url. And also handle the case when a blog has only one language support

@walleeva2018

@nurRiyad
Copy link
Owner

nurRiyad commented Aug 1, 2024

@walleeva2018
Copy link
Author

To clear our thought about url translaiton

To check popular website how the impolemnt

So keeping the names of the files similar will hamper the SEO performance.

We can check for indexes I guess. To fetch blogs we can check lang and index from the current route. In this way we can update the URLs in locale language without changing the structure of the project. Is it viable?

@walleeva2018
Copy link
Author

First of all thanks for the PR. I have not gone through the code. From only seeing the UI my thoughts are

  • Need to update the language switching selectbox because it's huge and break the navbar in mobile view
  • If we are in a blogs details page like link and then changes the language it's gives use nuxt error. We need to handle it
  • We need to find a better way for blog url. And also handle the case when a blog has only one language support

@walleeva2018

For one language Should We even show the language switcher??

@nurRiyad
Copy link
Owner

nurRiyad commented Aug 1, 2024

First of all thanks for the PR. I have not gone through the code. From only seeing the UI my thoughts are

  • Need to update the language switching selectbox because it's huge and break the navbar in mobile view
  • If we are in a blogs details page like link and then changes the language it's gives use nuxt error. We need to handle it
  • We need to find a better way for blog url. And also handle the case when a blog has only one language support

@walleeva2018

For one language Should We even show the language switcher??

As this repo will work as a template. We can have at least two language support in this repo and a language switcher. If anyone want to use only for one language they can remove it. Or we can give a simple on and off option in out nuxt config to disable the multi language support

Signed-off-by: zubairrafi <walleeva2018@gmail.com>
@walleeva2018
Copy link
Author

Hey @nurRiyad

Things I Have Fixed

  • Optimized for mobile view
  • Language switcher works in blogs
  • Optimized for less blogs in locale language, showed English blogs if necessary

Things to look out for

  • Its a huge change almost in every file so make sure everything works , I have checked In my point there are lots of discussion needs to be done
  • The build fails because of the preview renderer because of the way I handled missing link. If you approve that I guess it can be fixed
  • To allow multi-lang or not is implemented. Thats also needs to be discussed

Let me know what you think of these changes. If you want I can re-work and make it as you like hopefully

@nurRiyad
Copy link
Owner

I think it's build failing. Need to check @walleeva2018

@nurRiyad
Copy link
Owner

Screenshot 2024-08-13 at 9 18 29 PM

@walleeva2018
Copy link
Author

Screenshot 2024-08-13 at 9 18 29 PM

@nurRiyad As I mentioned Above why the build fails. Let me elaborate suppose my blogs site has 6 English Blog and 4 German. Now If I switch to German I will still be able to see the 2 extra English Blogs in proper order. Now I Make language switch in any page missing translation is handled logically. But what pre-renderer do is search for that missing translation which is not there thats why the build fail .

404 for pre-renderer is still a open issue in Nuxt Content Here

Possible Solution :

  1. We don't allow user to have missing translation if enable localization is true
    Or
  2. We Disable Pre-renderer after testing it locally if the errors are only 404

What do you think? Or Am I missing Any better method?

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.

2 participants