Ask coding questions

← Back to all posts
How do you make a language selecter
Coder2404 (361)

I need to make a language selecter to change the language of my website so if someone speaks Chinese they can change the language.

Answered by tussiez (1503) [earned 5 cycles]
View Answer
Comments
hotnewtop
tussiez (1503)

@Coder2404 Use the HTML lang attribute

<p>English</p>
<p lang="fr">Français</p>
Coder2404 (361)

Thanks, again for your help, I really appreciate it @tussiez

Coder2404 (361)

I really need your help for something @tussiez

tussiez (1503)

@Coder2404 You forgot to close the </h2> tag.
</h2 --> </h2>

Coder2404 (361)

Thanks, without you I wouldn’t of fixed it @tussiez

Coder2404 (361)

@tussiez I have one last question for you.
How do you put text to the top, left corner in css?
(Sorry if I’m annoying)

tussiez (1503)

@Coder2404 Someone already answered you lol :)
Np
Use a <style> element

<style>
#an_element {
position:absolute;
left:0;
top:0;
}
</style>
<div id="an_element">I am in the top left</div>
Coder2404 (361)

( LOL I know someone answered me but they didn’t really explain it, YOU did @tussiez )

Coder2404 (361)

BTW thanks for showing me how, you’re the best :) @tussiez
(Is this css or html, I can’t tell?)

Coder2404 (361)

Hey @tussiez did you ever check out my website?
(Btw I’m NOT advertising) And DON’T LIE.

Coder2404 (361)

@tussiez so do you want to guess my age?
(And DON’T laugh at me OR make fun of me when I tell you my age)

Coder2404 (361)

Just guess my age @tussiez it’s between 0 to 16

tussiez (1503)

@Coder2404 Good, thanks for asking :)

tussiez (1503)

@Coder2404 The post doesn't exist.

Coder2404 (361)

Hey @tussiez how are you, I have been good, how about you?

Coder2404 (361)

@tussiez I have to start my website all over again :/

Coder2404 (361)

@tussiez I accidentally deleted some code, and I don’t know how to fix it, there are so many errors

                     :(
Coder2404 (361)

@tussiez The only thing that is good, is that I can try to make my new website better then the last one. Even though I’m still sad :(

Coder2404 (361)

@tussiez sighs I can’t believe I have to start over...

Coder2404 (361)

@tussiez hey, how have you been lately?

Coder2404 (361)

@tussiez how are you, I’ve been good..

Coder2404 (361)

@tussiez hi, how have your day been?

Coder2404 (361)

@tussiez Good too, but I can’t really tell how good the day would really be because the day just started!

Coder2404 (361)

@tussiez To be more specific, I just have to make the content of the sidebar clickable and stuff

Coder2404 (361)

@tussiez hey, can you tell me your time zone?I will tell mine afterwards.If you don’t want to because you feel uncomfortable then you don’t have to.

tussiez (1503)

@Coder2404 Eastern Time (-5:00?) it's 10:02 here

edit: 10:02 AM

Coder2404 (361)

@tussiez it just turned 10:08 AM for me btw I’m in the GMT-5 I think

tussiez (1503)

@Coder2404 Yes, it looks like you're in the same time zone as me

Coder2404 (361)

@tussiez just different names
What state are you in? Btw I’ll tell mine.

tussiez (1503)

@Coder2404 It's not a good idea to tell people where you live on the Internet (dangerous) !!

Coder2404 (361)

@tussiez Yeah I guess but only that it’s a state, and they don’t even know you name, age, email, city and all that other stuff.

tussiez (1503)

@Coder2404 We shouldn't be chatting on a public page

tussiez (1503)

@Coder2404 Anyone can see this comment thread online by searching it up :>

Coder2404 (361)

@tussiez so what are we supposed to do?

Coder2404 (361)

@tussiez and NOT all people are hackers, you know.
(I wasn’t trying to be mean)

Coder2404 (361)

@tussiez so we talk on a PRIVATE page?

tussiez (1503)

@Coder2404 what page would that be?

Coder2404 (361)

@tussiez I meant we can talk on a page that is private.

Coder2404 (361)

@tussiez I can just invite you to a repl and there is a chat box, it’s private because I’m ONLY inviting you so it WILL be private

Coder2404 (361)

@tussiez I saw your last message, you’re working on a repl rn?

Coder2404 (361)

@tussiez BTW talk to you later..

Coder2404 (361)

@tussiez can you join the repl now?

Coder2404 (361)

@tussiez BTW I’m done with my website, it’s in the first version :)
(Btw NOT advertising)

tussiez (1503)

@Coder2404 Good, how are you? Also - are you in school? Don't comment in school! Lol

Coder2404 (361)

@tussiez I’m good too, and I am in school. Also LOL

Coder2404 (361)

@tussiez you’re in class too? At 1:00 I’m going to start class again, right now is my lunch break, so that’s why I can still talk to you.

tussiez (1503)

@Coder2404 Ah, K
I'm in school by 7:20 (bus ~6:40), class starts @ 7:25 and ends around 1:50

Coder2404 (361)

@tussiez are you remote because I am. Also that’s a long day.
And my classes ends at 1:50 too.

tussiez (1503)

@Coder2404 Oh, that's why you can comment LOL
I'm in in-person school

Coder2404 (361)

@tussiez then how can YOU talk to me if you are in in-person school?
And LOL

Coder2404 (361)

@tussiez And I’m LITERALLY multitasking
I’m in google meet, I’m doing my work, and I’m talking to you
LOL

tussiez (1503)

@Coder2404
Oof
I typed on my school computer:D

Coder2404 (361)

@tussiez oh ok, that makes more sense

Coder2404 (361)

@tussiez but how can you still talk to me I thought you said at 1:50 school ends

Coder2404 (361)

@tussiez oh yeah, I’m really dumb

tussiez (1503)

@Coder2404 Doing well! How about you?

Coder2404 (361)

@tussiez I’m good too, and sorry I didn’t respond to you quickly like usually...

Coder2404 (361)

@tussiez thanks, I appreciate it
And how did you reply soo quickly, don’t you have school?

tussiez (1503)

@Coder2404
I'm in a hybrid model, so I'm home this Friday

Coder2404 (361)

@tussiez I have school in 2 minutes, but I can try to focus on class and talk to you, so I will have to split my screen, if that’s okay with you..

Coder2404 (361)

@tussiez
What is hybrid model?
And ok then

Coder2404 (361)

@tussiez welp better go to class, I’ll split my screen in one second...

Coder2404 (361)

@tussiez I’m just going to wait one minute because the teacher didn’t post the google meet link yet..

Coder2404 (361)

@tussiez I’m splitting my screen...I’m done splitting my screen!

Coder2404 (361)

@tussiez I’m on a mobile device, I just found out how to split my screen on my mobile device a few months ago..

Coder2404 (361)

@tussiez whoops, I accidentally made a blank comment, oh well!

Coder2404 (361)

@tussiez aw man, I’m doing a math test, I have to focus on it, I can’t talk to you, but I’ll talk to you when I’m done okay?

Coder2404 (361)

@tussiez I’m back, we can talk now

Coder2404 (361)

@tussiez do you have anything to ask or tell me?

tussiez (1503)

@Coder2404 Oh, and by the way, you should remove your birthdate from your website. It's not very safe to put your birthday and your full name on the Internet, as this is personal information and can be used to identify you

tussiez (1503)

@Coder2404 I used to have my name on my profile, but I removed it because - personal info

Coder2404 (361)

@tussiez do you want the link? I could give it to you..
If you don’t it’s fine.

Coder2404 (361)

@tussiez Ok then, what do I add to “ About me” then?

tussiez (1503)

@Coder2404 Good question. You can write about what you like to do for fun, your favorite sport, TV show(s), movies, etc

I saw the link in your Repls list :D

Coder2404 (361)

@tussiez and just saying that not all people are hackers

Coder2404 (361)

@tussiez do you have your own website?

tussiez (1503)

@Coder2404 Thanks! I'm updating it RN

Coder2404 (361)

@tussiez how come I don’t see it?

tussiez (1503)

@Coder2404 Click "Dark/Light Mode"

Coder2404 (361)

@tussiez your “website” is better than mine..

Coder2404 (361)

@tussiez at least you know how to do light mode and dark mode...

tussiez (1503)

@Coder2404 Not too hard, do you want to know how?
Simply set a class in the CSS for color:black/color:white and use a little command to go through all the elements in your document that you need to change to light/dark mode:

function darkMode(){
let a = document.getElementsByTagName('a'); // All <a> elements
for(let i in a){
// Loop through all a elements
a[i].className = 'darkMode';
}
document.body.style.backgroundColor = '#333'; // Make the background dark gray
}

CSS:

.darkMode {
color: white; 
/* Make the elements with darkMode class have a white font color (on black text)
}
.darkMode:hover {
/* This can be whatever you want */
/* I make the text underlined here */
text-decoration:underline;
}

and do the opposite for light mode

Coder2404 (361)

@tussiez can you teach me how to make a light/dark mode?

tussiez (1503)

@Coder2404 Yes, use the code above

Coder2404 (361)

@tussiez can we collab? I need your help.

Coder2404 (361)

@tussiez I’ll add you in credits, of course.

Coder2404 (361)

@tussiez thanks, we will start tomorrow

Coder2404 (361)

@tussiez hey, we’re collaborating, remember?

Coder2404 (361)

@tussiez are you there? We have to do the collab...

Coder2404 (361)

@tussiez ok I’m going to share the repl, I’m going to explain in one second....

Coder2404 (361)

@tussiez AND don’t destroy anything else in the repl or I’ll be really mad.

Coder2404 (361)

@tussiez I don’t have much screen time left so....

Coder2404 (361)

@tussiez um where are you I can’t see you in the repl..

Coder2404 (361)

@tussiez you have homework on a Sunday?

Coder2404 (361)

@tussiez I don’t have homework, you’re actually lucky because when Covid19 was not here I could do my Friday homework on the weekends, but now all my homework from google classroom on Friday is due on Friday 5:00 :(

Coder2404 (361)

@tussiez when are you free tomorrow? just tell me the time then I can do the collab then..

tussiez (1503)

@Coder2404 Rip
After school - same time as you (if you're in Eastern Time IIRC)

Coder2404 (361)

@tussiez I’m in GMT-5 at least I think so

Coder2404 (361)

@tussiez I can’t do it after 1:50 pm and that‘s when I finish school
Because my parents won’t let me have more screen time after school which is 1:50 pm
When is your lunch break?
We could use your lunch break

Coder2404 (361)

@tussiez but here is my school day schedule
8:50-9:00 I can talk to you
9:00-10:15: Math
10:15-10:30 I can talk to you
10:30-11:10: Technology
11:10-11:25:I can talk to you
11:25-12:15: Reading
12:15-1:00: Lunch break (I can talk to you while eating)
1:00-1:50:Writing
1:50- End of day :(

Coder2404 (361)

@tussiez when do you want to do the collab tomorrow? Because I can’t do it now..

tussiez (1503)

@Coder2404 Ah
6:30 - 7:25 Morning/bus ride
7:25 - 11:57 Classes (no break)
11:57 - 12:17(?) Lunch (no computer)
12:17 - 1:05 Classes
1:05 - 1:50 Kinda class (Can talk)
1:50 - ~2:10 Bus
That's mine

Coder2404 (361)

@tussiez so you can’t do it on lunch?
Then when can we do the collab?

Btw here is my updated schedule
8:50-8:51-Morning (Getting ready)
8:51-9:00- Can talk to you
9:00-10:15: Math (Can’t talk)
10:15-10:30 I can talk to you
10:30-11:10: Technology (Can’t talk)
11:10-11:25:I can talk to you
11:25-12:15: Reading (Can’t talk)
12:15-1:00:I can talk to you (lunch break)
1:00-1:50:Writing (Can’t talk)
1:50- End of day (Can’t talk D: )

Coder2404 (361)

@tussiez but, I don’t have any more screen time after school...

Coder2404 (361)

@tussiez I only have 2 more minutes of screen time right now so talk to you tomorrow

Coder2404 (361)

@tussiez and we’re going to discuss when we are going to do our collab so bye for now...

Coder2404 (361)

@tussiez hey, how have you been lately? I have been great!

Coder2404 (361)

@tussiez
Here is today’s schedule

8:50-9:00- Getting ready/Going on repl.it (Can talk)

9:00-10:10 Google Meet: Attendance and Math (Can’t talk)

10:10- 10:30 - Physical Education (gym) / Movement Break (Can talk when done with gym)

10:30-11:11- Meet / Zoom: Technology (Can’t talk)

11:11- 11:25- Finish Math and Study for Test (Can talk when done studying)

11:25 - 12:15- Google Meet: Reading and Independent Work (Can’t talk)

12:15- 1:15- Lunch Time (Can talk)

1:15-1:50 Google Meet : Digital Citizens!! (Can’t talk)

1:50- 2:20- Sel Activity/ End of day :D (Can’t talk)

Coder2404 (361)

@tussiez lol
But where have you been? I replied to you soo many times

Coder2404 (361)

@tussiez um, are you still in class?

tussiez (1503)

@Coder2404 Yes
Aw, it's OK (no harm)

tussiez (1503)

@Coder2404
Want to see the new SortaCraft?

RowanFromBJC (46)

I know that this was already answered, but you can also use the Google translate API.
Code:

<!DOCTYPE html>
<html>
<head>
<script src="https://translate.google.com/translate_a/element.js?cb=translate"></script>
<script>
function translate() {
new google.translate.TranslateElement({pageLanguage: 'en'}, 'google-translate');
}
</script>
<!-- the rest of your head code-->
</head>
<body>
<div id="google-translate"></div>
<!--the rest of your body code-->
</body>
</html>
Coder2404 (361)

@RowanFromBJC it doesn’t work....
Did I do something wrong?

RowanFromBJC (46)

@Coder2404 Sorry, I updated it. Try it again...?

Coder2404 (361)

@RowanFromBJC still doesn’t work, it’s okay though...

Coder2404 (361)

@RowanFromBJC let me see your code, maybe I did it wrong..

Coder2404 (361)

@RowanFromBJC oh thanks, BUT that’s not a language SELECTER...
(Just saying I wasn’t trying to be mean)

RowanFromBJC (46)

@Coder2404 Ok, I didn't understand what you meant by language selector, but your problem is solved, right?

Coder2404 (361)

@RowanFromBJC
This is what I mean
https://coder2195.vercel.app/
You see, that when you press the blue settings button, there is a selecter in the middle for language you can change the language. That is what I want..
Btw that’s NOT my website.