HTML lang tag setting

Permalink Browser Info Environment
I've set up my trial site with several language trees and all works fine.
However, looking at the generated HTML it seems that the <html> tag is always <html lang="en">

What am I doing wrong? I was hoping that it would automatically change to (for example) <html lang="es"> or <html lang="de">

Thanks in advance for any help.

PS I'm using the default greek yogurt theme.

Type: Discussion
Status: In Progress
bedbug2000
View Replies:
Korvin replied on at Permalink Reply
Korvin
Within Greek_yogurts header, you'll see
<html lang="<?=LANGUAGE?>">
This should handle the lang, are you sure that you're changing the language correctly?
bedbug2000 replied on at Permalink Reply 3 Attachments
bedbug2000
I *thought* I had :)
I followed the video linked from the marketplace (separate subtree for each language, top page of each subtree is set to the country code, content copied between trees and adapted).

I noticed the piece of code you quoted in the php code, so thought it should cope.

I have C5 installed in a subdirectory of the site (/concrete5.5.2.1), but it was all setup with this path from the start.

I'm obviously making some stupid mistake, the problem is I can't see where.
I'll attach a couple of screenshots in case they help.
thanks for trying to help and thanks in advance for any other help you can offer.
tim
Korvin replied on at Permalink Reply
Korvin
Is there a public url for this site? It's possible that you're defining the LANGUAGE to en before or after it gets set, also that you're just misreading it :S

Best wishes,
Korvin
bedbug2000 replied on at Permalink Reply
bedbug2000
Sorry, it's on a private VM.
However, at least I now know that it should switch languages.
So I guess I'll start over from scratch and try again, trying to be a bit more meticulous this time.
Thanks for your help.
Tim
bedbug2000 replied on at Permalink Reply
bedbug2000
OK so I've finally got round to trying concrete5 again.
Raw install.
Add internationalization addon.
Create English, Spanish, French home pages below root (URLs /en, /es, /fr).
Linked them up in the multilingual setup page.
Default theme.
The pages always show
<html lang="en">
.

I notice that a lot of the sites linked from the addon page (in the Used on Sites page) have the same problem (eg Sunsladehttp://www.sunslade.com/ - always shows
lang="fr"
, Hotel Andreashttp://www.hotelandreas.com/ - always shows
lang="en"
, Druidenwissenhttp://druidenwissen.ch/ - always shows
lang="en"
).

Yksituumahttp://www.yksituuma.fi/ works well. So does TRAVLitehttp://travlite.net/.
They both set
lang="fi"
(or whatever) as appropriate.

Am I missing something? If so, a bunch of other people are missing it, too.

I tried updating elements/header.php from
<html lang="<?php echo LANGUAGE?>" xmlns="http://www.w3.org/1999/xhtml">

to
<html lang="<?php echo Loader::helper('section','multilingual')->getLanguage()?>" xmlns="http://www.w3.org/1999/xhtml">


Now it shows
lang="en_GB"
or
lang="es_ES"
.

So what am I doing wrong/different?

thanks for any help you can offer.

cheers,
Tim
EvanCooper replied on at Permalink Reply
EvanCooper
I think what you want to echo there is the msIcon? I believe that's just the first bit. Or you could just explode that string on '_' and just use the first element in the array or whatnot.
bedbug2000 replied on at Permalink Reply
bedbug2000
Aha! Thanks for the hint.
I did a bit more digging and replaced
<html lang="<?php echo LANGUAGE?>" xmlns="http://www.w3.org/1999/xhtml">

with
<html lang="<?php echo Loader::helper('section','multilingual')->getSectionByLocale()->getLanguage()?>" xmlns="http://www.w3.org/1999/xhtml">


and it now correctly changes the html tag to
<html lang="en">

or
<html lang="es">

or whatever.

thanks for your help.

Tim

PS Perhaps the developers for this addon could make a small change to the docs/tutorials to help people get the html lang attribute right. Otherwise, the pages may look OK on a browser, but you'll be giving inconsistent information to search engines - so your pages may not get presented/found correctly in searches.
BirgirGisla replied on at Permalink Reply
BirgirGisla
bedbug2000, thank you so much for your solution, it saved me hours in figuring out a solution for my new multilingual site. This should be added as an advice on how to implement the free Multilingual plugin.
fbartsch replied on at Permalink Reply
fbartsch
That worked for me too! Thank you!

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.