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.
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 |
Within Greek_yogurts header, you'll see This should handle the lang, are you sure that you're changing the language correctly?
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
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
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
Best wishes,
Korvin
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
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
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.
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, Hotel Andreashttp://www.hotelandreas.com/ - always shows , Druidenwissenhttp://druidenwissen.ch/ - always shows ).
Yksituumahttp://www.yksituuma.fi/ works well. So does TRAVLitehttp://travlite.net/.
They both set (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
to
Now it shows or .
So what am I doing wrong/different?
thanks for any help you can offer.
cheers,
Tim
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"
lang="en"
lang="en"
Yksituumahttp://www.yksituuma.fi/ works well. So does TRAVLitehttp://travlite.net/.
They both set
lang="fi"
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"
lang="es_ES"
So what am I doing wrong/different?
thanks for any help you can offer.
cheers,
Tim
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.
Aha! Thanks for the hint.
I did a bit more digging and replaced
with
and it now correctly changes the html tag to
or
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.
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.
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.
That worked for me too! Thank you!