Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Ability to change the language of the website #34

Closed
MrTorfick opened this issue Nov 12, 2023 · 6 comments · Fixed by #44
Closed

Ability to change the language of the website #34

MrTorfick opened this issue Nov 12, 2023 · 6 comments · Fixed by #44
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@MrTorfick
Copy link

MrTorfick commented Nov 12, 2023

Is your request related to a problem? Please describe it.
Not a problem

**Describe the solution you would like to see
By some select, or some kind of option, allow the user to select a language. Or automatically detect the browser language, and implement it.

Describe the alternatives you have considered A clear and concise description of the alternative solutions or features you have considered.
Browser translations (which are not accurate)

Additional context
Add here any additional context or screenshots about the feature request.

Code
I could implement it, it would take me some time. I would like to know if you don't mind if I implement this functionality. In my case I would translate the site into Spanish.

@MrTorfick MrTorfick added the enhancement New feature or request label Nov 12, 2023
@drHyperion451
Copy link
Owner

Hello. I was thinking about that lately (since I'm not a native english speaker). However, I have no clue on how to implement this due to lack of experience on web development. Maybe we could set multiple html files inside a lang folder and then redirect them or another better solution that is not horrible for maintaining this in the future.

@drHyperion451 drHyperion451 added the help wanted Extra attention is needed label Nov 13, 2023
@thecooldoggo
Copy link
Contributor

That's a good idea. One way to implement it would be to use
window.onload = function() { var userLang = navigator.language || navigator.userLanguage; if (userLang.startsWith("es")) { window.location.href = "spanish.html"; } }
to auto detect the language and redirect to another page like spanish.html. My example is not perfect but it would go along the lines of that.

@drHyperion451
Copy link
Owner

redirect to another page like spanish.html

This is a good option, but this is very panful if you want to support more than one language and want to maintain the project. Any change or addition we apply on the english html should be changed in all languages too.

I was thinking on two options actually:

  1. Leave the index.html and add ids to each piece of information. Create a json for each language and add the translations there.
  2. Remove the banner completely inside the index.html and generate this using javascript on the execution time.

I view the second one overcomplicated.

I'm very busy right now irl, so maybe this project wiill have less frequent updates

@drHyperion451
Copy link
Owner

@MrTorfick Lets make something provisional for now.

Copy the index.html file to lang/spanish.html and make the translations you want there. The spanish version will be in this route for now until I create something better.

@drHyperion451
Copy link
Owner

Okay. I think I will do something like this: https://www.youtube.com/watch?v=hBYVxQLtrqQ

@MrTorfick
Copy link
Author

Okay. I think I will do something like this: https://www.youtube.com/watch?v=hBYVxQLtrqQ

Thanks for passing me that video, I will keep it in mind.

I will probably do the translation at the end of December, which is when I have free time.

Sorry for the delay in my reply, I have had some unforeseen events that have taken me a lot of time.

@drHyperion451 drHyperion451 linked a pull request Dec 22, 2023 that will close this issue
7 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants