[TYPO3-english] Issue after removing 'fr' part

Xavier Perseguers typo3 at perseguers.ch
Sun Feb 15 10:38:09 CET 2009

 > [...]
> With this in place, when generating a "French" URL with default language 
> set to 'fr', I get the '/fr/' prefix for my URL.
> The problem I had is that when decoding back the URL, decodeSpURL() 
> should be extended too to actually unset the map 'fr' => '2' which will 
> lead to setting the L parameter to 0 and not to 2. To do this I added 
> code below to my XCLASS class:
>     function decodeSpURL($params, &$ref) {
> unset($params['pObj']->TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT']['preVars'][1]['valueMap']['fr']); 
>         parent::decodeSpURL($params, $ref);
>     }
> The point is that I cannot access the config defaultLanguage at this 
> point, it is not available (or I did not find it).
> Hence, I *cannot* unset the default language mapping dynamically and as 
> such I have to find another way. The other way is easy: do not prepend 
> '/fr/' to my URL when default language is French. This means that I 
> should not set 'valueDefault' to any value but should use 'noMatch' => 
> 'bypass' instead. My final config now reads:
> array(
>     'GETvar'   => 'L',
>         'valueMap' => array(
>             'de' => '1',
>             'fr' => '2',
>             'it' => '3',
>             'en' => '4',
>         ),
>         'noMatch' => 'bypass'
> ),
> and there's no need to XCLASS realurl anymore.

Now as long as I stay on a default-language-is-French part of my 
website, it's OK. But when I go to a default-language-is-English it does 
not work anymore as the links back to French content have '/fr' prepended.

A step back to the configuration to show you how it works with only two 
languages instead of 4 (I chose French and German to keep the same 
sys_language_uid as in my text before):

|-- page1 (default is French)
|   `-- page1.1
`-- page2 (default is German)
     `-- page2.1

To achieve this, I need 2 domain languages, German (sys_language_uid=1) 
and French (sys_language=2).

Two different TypoScript should be applied to page1 and page2 to 
/change/ the default language. The point is to generate the language 
menu with other sys_language_uid:

For French-is-default, having a menu showing "DE | FR", I should have

lib.links.languages.special.values = 1,0

While for German-is-default, I should have

lib.links.languages.special.values = 0,2

The rest (such as showing a France or Germany icon when editing default 
language content is just a matter of changing mod.SHARED stuff in the 
/pageTS/ of page1 and page2 and using a small patch (currently pending 
in core- and in TV-list) to hide available page translations that do not 
make sense. However it does not matter here.

My real setup is a bit different though:

|-- page1 (default is French)
|   |-- page1.1
|   `-- share (mount point to shared pages)
`-- shared pages (default is German)
     `-- subpages

(In my case default is English for shared pages but it is not relevant 

I have a domain record on page1, allowing me to access my website using 
a domain root, let's say http://www.domain.tld/.

My mount point to shared pages does not appear in the menu of subpages 
of page1 but is used to generate via TS links to shared pages such as 
"login", "impressum", ... in header / footer of the design with code such as

lib.links.login.stdWrap.typolink.additionalParams = 

when having French as default language. This way I will force links to 
shared pages to have the language specified. When French is default, L=0 
but when I link to a shared page which is not French, I should specify 
the French language to keep browsing my website in French. This is the 
reason I added L=2 at the end of the link.

Using RealURL, my links are generated this way when I'm on page1:


(note the "fr" in the last link)

But when I'm on subpages, links are all prepended with "fr":


Now I remember why I wanted all my pages to be prefixed by the language, 
even if default language was used.

... Meaning I have to find the solution XCLASSing RealURL to dynamically 
specify the default language to be used.

Xavier Perseguers

One contribution a day keeps the fork away

More information about the TYPO3-english mailing list