HOW TO: xml:lang=YOUR LANG de en es se fr it ...

If you have created additional (non official) documentation or tutorials or something like that please post this here
Post Reply
User avatar
Jensensen
Posts: 2996
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

HOW TO: xml:lang=YOUR LANG de en es se fr it ...

Post by Jensensen »

You probably noticed that --> config

Code: Select all

$phpwcms['default_lang']      = 'ABC';  //default language
is responsible for the xml:lang source code of the page, like for example:

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ABC" lang="ABC">
But what happens when you have a multilingual site [SEO] running with many different site structure levels for each language (so called 'trees')?

The visitor and any --> search engine will get --> DEFAULT ==> 'ABC'
--> for EVERY PAGE in --> each tree - EVEN for those pages which content ACTUAL was written for example in ES, IT, SE, DK, UK. FR, EN...

hmm, I think this is very unsatisfying, disappointing.

[But did you know that :?: ]
You'll succeed by --> CUSTOM templates that will override --> CONF :!:

Just ADD [this conf-var! :shock: ]:

Code: Select all

$phpwcms['DOCTYPE_LANG'] = "whatever_lang";
to
[a custom template :? 8) for me THIS was new because THERE never was DOCTYPE_LANG in]

/template/inc_settings/template_default/MYcustom_settings.php

[ http://code.google.com/p/phpwcms/issues/detail?id=147 ]

or frontend_init something :idea:

PS: i like en es se NL fr it jes most ...
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
santscho
Posts: 1442
Joined: Mon 2. Apr 2007, 08:56
Location: Schweiz

Re: HOW TO: xml:lang=YOUR LANG de en es se fr it ...

Post by santscho »

Great! Exactly what I need for my multi language site. Thanks a lot.
Schon Konfuzius sagte: "Sei kein YAML-Lappen". YAML-phpwcms-Integration auf http://www.yaml.phpwcms.org
User avatar
Heiko H.
Posts: 868
Joined: Thu 27. Oct 2005, 11:41
Location: Dresden
Contact:

Re: HOW TO: xml:lang=YOUR LANG de en es se fr it ...

Post by Heiko H. »

WOW!!!
Good work! THX!
Not longer here - sorry...

Haubner-IT GbR Dresden
User avatar
update
Moderator
Posts: 6433
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: HOW TO: xml:lang=YOUR LANG de en es se fr it ...

Post by update »

Jensensen wrote:or frontend_init something :idea:
Do you have any idea?
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
User avatar
Jensensen
Posts: 2996
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: HOW TO: xml:lang=YOUR LANG de en es se fr it ...

Post by Jensensen »

I'm sorry that not.
I'm sorry for the irritation, also. That was a citation [OG] of the issue #147 thread only - not my idea.

I actually don't have any idea for FE-init scripts in this case. I'd prefer custom templates to use.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: HOW TO: xml:lang=YOUR LANG de en es se fr it ...

Post by flip-flop »

Mhh, i don´t understand this recurring question.

Put it into e.g. frontend_render:

Code: Select all

$GLOBALS['phpwcms']['DOCTYPE_LANG'] = "en-za";
Result:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-za" lang="en-za">
:roll:
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
update
Moderator
Posts: 6433
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: HOW TO: xml:lang=YOUR LANG de en es se fr it ...

Post by update »

OK, soweit klar. Wenn jetzt ein Browser mit der Sprachpräferenz [fr] daherkommt, hat der DOCtype aber auch [en-za] drin stehen, oder? Also müsste der frontend renderer die Browser-lang abfragen -ein switch sozusagen- und dann injizieren....
Ok, this is cleared so far. But a browser with a language preference of [fr] will get injected this [en-za] too. So there is a need for some additional switch.... ask for browser lang preferred and inject this, not that... or something similar
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
User avatar
update
Moderator
Posts: 6433
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: HOW TO: xml:lang=YOUR LANG de en es se fr it ...

Post by update »

Ok, if I place a file named inject_doctype_lang.php into frontend_render containing

Code: Select all

<?php
$phpwcms['DOCTYPE_LANG'] = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
?>
I'm getting something like
xml:lang="en-US,en;q=0.7,en-us;q=0.3" lang="en-US,en;q=0.7,en-us;q=0.3"
or
xml:lang="de-DE" lang="de-DE"
So far, so good.... what else? ;)
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Post Reply