Languages

Back to Overview
00:00 --> 00:08
Now, let's talk about language. So, you need to set the language of your page and the language of parts on the page.

00:10 --> 00:16
So, if we're going back to the W3C side, on the top right, you see this all translations page.

00:16 --> 00:24
This is not super useful at the moment for the page that we've been on, because that has not been translated.

00:24 --> 00:33
But if we look at Spanish, we see that there are several pages that have been translated into Spanish.

00:33 --> 00:43
So if we go to the business case for digital accessibility, we see that this is translated into Spanish.

00:43 --> 00:48
And there is an English version, of course, that has been the basis for that.

00:48 --> 01:08
Now, when a screen reader accesses a page, they need to know what is going on, what is this website in, what is that content for, in what language is that content.

01:08 --> 01:13
And it does that on the language that the website specifies.

01:13 --> 01:21
So if you look into the code, so that's how you usually test that, you see that there

01:21 --> 01:29
is, I'll try to make this a little bit bigger, you see that there are some attributes on

01:29 --> 01:34
the HTML element and one of that says langen.

01:34 --> 01:41
And that basically says the whole language, the general language of this page is English.

01:41 --> 01:55
There are a couple of ways to do this. Lengen is the most common one, but you could even use regional variations like en-gb for Great Britain.

01:55 --> 02:03
And then, you know, you would say like, oh, this should be British English. That might make a difference in some cases.

02:04 --> 02:12
Usually you can just use like the generic, like most top level language because it doesn't matter.

02:13 --> 02:16
And also you have to have this language installed in your system.

02:16 --> 02:25
Otherwise, there will be no announcement at all or it will try to read it in the language of the screen reader.

02:26 --> 02:28
And that, you know, will sound funny.

02:28 --> 02:32
Now if we go back to the Spanish page.

02:32 --> 02:51
We see that it's changed to language equals yes for Espanol. So that basically says, oh, this whole page now is Spanish and everything is translated like this.

02:51 --> 02:58
Let's jump to a content button, all the links here.

02:58 --> 02:59
This is translated.

02:59 --> 03:08
So everything is basically translated, even the Chrome around the actual article.

03:08 --> 03:12
So you can go and change the HTML here at the top.

03:12 --> 03:20
But sometimes you have places where you have Swedish text inside of an English page or

03:20 --> 03:27
something like that. And in those cases, you want to use the lang attribute as well,

03:27 --> 03:32
but you want to put it onto that specific element or on that specific container.

03:32 --> 03:45
So if we go back to the, to the Espanol Spanish section here, and we go to inspect that,

03:46 --> 03:54
because the surrounding page is English, right? This is an English page with Spanish content,

03:54 --> 04:02
and actually with a lot of languages like here's Greek, and here is German. And so you have these

04:02 --> 04:07
different sub languages that you want to support, you know, you want this translator

04:09 --> 04:17
announcement and the headings, you want them to be announced in the language that is actually used,

04:17 --> 04:30
because that's what the user would search for. And as you can see here, the definition list that

04:30 --> 04:39
is inside of this details basically says like the language is Spanish, and then that means everything

04:39 --> 04:48
inside here is Spanish, apart from this second, uh, uh, the second DD third item inside of this,

04:49 --> 04:58
uh, diff, which is in English. So in this case, the, um, uh, the screen reader can basically

04:58 --> 05:04
switch languages in between, and this was for such a page. This makes a lot of sense. Now

05:05 --> 05:13
You don't want to always use language switching all the time.

05:13 --> 05:30
For example, if you have like the one Spanish language word inside of an English text, like hola, he said, you know, and there are sentences before and afterwards in English.

05:31 --> 05:42
You don't want to switch this one word in general because switching languages can incur a short delay.

05:42 --> 05:51
So you have a longer time that you have there that you need to wait as a screen reader user and that can be a little bit disrupting.

05:52 --> 05:59
Also, a lot of language is just like very common in the language that you're using.

06:00 --> 06:07
For example, in German, you wouldn't translate the word computer or something like that.

06:07 --> 06:22
So, you know, even if it's not laid out like that or the language tag is not on there, it still would be easy or easy enough to understand.

06:23 --> 06:29
But, you know, for a page with that, with a lot of like changing languages, it makes total sense to do it.

06:29 --> 06:52
Let's take a look at what WCAG is saying about that. There we go. One and the other. Open it. So, success criterion 3.1.1 is the default human language of each web page can be programmatically determined.

06:53 --> 07:02
So that basically says like, oh, you have to provide as a website, you have to provide that information in a programmatical way.

07:03 --> 07:05
There are a couple of ways to do this.

07:05 --> 07:12
Apart from the HTML way, for example, you can configure your server to send the language with it.

07:12 --> 07:18
Or you can, you know, set meta tags as well.

07:18 --> 07:20
It's like there are multiple ways to do it.

07:20 --> 07:25
The HTML one is the most simple one and that always works.

07:26 --> 07:28
And then we have language of parts.

07:29 --> 07:34
The next success criterion 3.1.2, which is a double A success criteria.

07:35 --> 07:39
While the language of the whole page is a single A success criteria.

07:40 --> 07:45
And that basically says the human language of each passage or phrase in the content

07:45 --> 07:49
can be programmatically determined, except for proper names, technical terms, words

07:49 --> 07:55
of indeterminate language and words or phrases that have become part of the

07:55 --> 08:00
vernacular of the immediately surrounding text. So that's basically what I said, like,

08:00 --> 08:07
oh, if this could belong to that text, then you don't have to do this. Yeah. And this

08:07 --> 08:12
is basically what you need to do to make sure that those meta things work properly.

08:12 --> 08:14
Thank you.