These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:06 pm Advanced search

language changes in title tag

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

language changes in title tag

Postby atu » Thu Jun 26, 2008 10:39 am

Hi,
It could be useful to insert the <bdo> tag in the <title> tag for including a title in more than one language. Screen reader users could profit from this. Example:

Code: Select all
<title>English
    <bdo lang="fr" dir="ltr">Français</bdo>
    <bdo lang="de" dir="ltr">Deutsch</bdo>
</title>
atu
<h6>
 
Posts: 1
Joined: Thu Jun 26, 2008 10:32 am

Postby zcorpan » Wed Jul 02, 2008 9:07 pm

This wouldn't work in text/html for parsing legacy reasons. You'd end up with the literal text "<bdo..." in the title, just like if you had written "&lt;bdo..."
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby Le Sage » Fri Jul 25, 2008 7:10 pm

Well, you could do that dynamically with a simple server technology as JSP or PHP. It's way harder that dynamically change any element value with JavaScript regarding the browser defined language, simply because as far as I know, the language is defined in the HTTP request, but can't really be accessed through JavaScript.
User avatar
Le Sage
<h3>
 
Posts: 54
Joined: Wed Dec 05, 2007 9:08 pm
Location: Casablanca, Morocco

Postby skitch » Sat Jul 26, 2008 6:47 am

If you're using the server to decide to give it HTML 5 or backwards-compatible HTML and the server has the language, then the server can output the correct title without JS or HTML helping.
skitch
<h6>
 
Posts: 4
Joined: Tue Feb 05, 2008 6:53 am

Postby ktf » Sat Jul 26, 2008 8:37 am

zcorpan wrote:This wouldn't work in text/html for parsing legacy reasons. You'd end up with the literal text "<bdo..." in the title, just like if you had written "&lt;bdo..."


Well, of course, but isn't it possible to build in HTML5, so that you can use it if about 98% of the users use it? Then the webmaster can decide whether to use it or not.
ktf
<h6>
 
Posts: 8
Joined: Fri May 25, 2007 3:06 pm
Location: Somewhere in The Netherlands

Postby zcorpan » Sat Jul 26, 2008 8:53 am

ktf wrote:
Well, of course, but isn't it possible to build in HTML5, so that you can use it if about 98% of the users use it? Then the webmaster can decide whether to use it or not.
I don't follow...
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby Le Sage » Sat Jul 26, 2008 9:41 am

skitch wrote:If you're using the server to decide to give it HTML 5 or backwards-compatible HTML and the server has the language, then the server can output the correct title without JS or HTML helping.

That's what I said when I spoke of PHP or JSP.
skitch wrote:Well, of course, but isn't it possible to build in HTML5, so that you can use it if about 98% of the users use it? Then the webmaster can decide whether to use it or not.

I guess you might mean that most webmaster don't have the possibility (or the knowledge) to use server-side dynamic webpages. Well, as zcorpan said, atu's solution can't be used because the title element can only contain pure text. & since JavaScript can't (as far as I know) detect the browser language, I'm afraid it's not possible to change dynamically any element according to the browser language, without any user action (like "please select your prefered language").
User avatar
Le Sage
<h3>
 
Posts: 54
Joined: Wed Dec 05, 2007 9:08 pm
Location: Casablanca, Morocco

Postby ktf » Sat Jul 26, 2008 9:58 am

Le Sage wrote:because the title element can only contain pure text


Ah, now I understand ;) Than it's indeed backwards incompatible.
ktf
<h6>
 
Posts: 8
Joined: Fri May 25, 2007 3:06 pm
Location: Somewhere in The Netherlands

Postby Le Sage » Sat Jul 26, 2008 12:59 pm

I guess you could try to parse (using an AJAX engine as jQuery is suggested here) the navigator.appVersion string data to detect the browser language (should be working on every browser, although less clean than using :
navigator.browserLanguage (IE & Opera, no FF)
or
navigator.systemLanguage (IE, no Opera or FF)
or
navigator.userLanguage (IE & Opera, no FF)
& then on the onload of your body, you could dynamically change the value of your title with JavaScript. That's the best I can suggest for now. Image (I'll do something like that on my webpage some day... Image
That's not a very good tweak, as it won't be able to read the user favorite language setting (in Firefox for example).
for the DOM navigator variable, see here : http://www.w3schools.com/js/tryit.asp?f ... _navigator
By the way, does anyone have any idea why FF doesn't support browser language detection ? I don't see any security flaw here, as the language is sent in the HTTP header.
User avatar
Le Sage
<h3>
 
Posts: 54
Joined: Wed Dec 05, 2007 9:08 pm
Location: Casablanca, Morocco

Postby OmegaJunior » Tue Jul 29, 2008 9:00 am

Off topic: It seems silly and unlikely that Firefox wouldn't be able to detect the user's language settings for the browser. Opera, Internet Explorer, and Firefox all allow the user to set their preferred web page language (and create new ones on the spot, too). The only competitive Windows browser that doesn't allow that (at least not easily) is Apple's Safari. Which is silly.
OmegaJunior
<h6>
 
Posts: 9
Joined: Sun Oct 07, 2007 1:37 pm
Location: Netherlands

Postby Le Sage » Tue Jul 29, 2008 6:10 pm

They are able to do it, but a webpage needs JavaScript to have a function for the web developper to be able to use it in its webpage. Image (or, once again, use dynamic webpages as PHP or JSP)
User avatar
Le Sage
<h3>
 
Posts: 54
Joined: Wed Dec 05, 2007 9:08 pm
Location: Casablanca, Morocco


Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 1 guest