Osclass forums

Support forums => General help => 3.6.x => Topic started by: mecene on May 12, 2017, 02:16:12 pm

Title: One domain name per language switch
Post by: mecene on May 12, 2017, 02:16:12 pm
Good morning,
I am currently trying to set up a classified site which has one domain name per language.
Unfortunately, I can't find a way to have it working properly.
The language switch href links have différents domain names, it refuses to change the page domain.

Goal :
domain.com -> en_US
domain.fr     -> fr_FR

and the language switcher should redirect to the related domain.

So far :


    function osc_language() { //mecene language domain name
        if($_SERVER['HTTP_HOST'] == 'domain.fr'){
            return('fr_FR');
        }else{
            return(getPreference('language')); // default en_US if .com
        }
       
    }

    function osc_change_language_url($locale) {

        $baseUrlEn = 'http://domain.com/';
        $baseUrlFr = 'http://domain.fr/';

        if ( osc_rewrite_enabled() ) {
                        switch ($locale) {
                case 'en_US':
                        return $baseUrlEn . osc_get_preference('rewrite_language') . '/' . $locale;
                    break;
             
                case 'fr_FR':
                        return $baseUrlFr . osc_get_preference('rewrite_language') . '/' . $locale;
                    break;
             
                default:
                        return osc_base_url() . osc_get_preference('rewrite_language') . '/' . $locale;
                    break;
            }
            //return osc_base_url() . osc_get_preference('rewrite_language') . '/' . $locale;
        } else {

            return osc_base_url(true) . '?page=language&locale=' . $locale;
        }
    }

This last code gives me the right links Url on the language switch but when I clic it nothing happens.
Could anyone help me with this issue or at least guide me to the right path or let me know that i am doomed with this crazy idea.

Kind regards
Title: Re: One domain name per language switch
Post by: Sophia_OS on September 19, 2018, 10:27:33 pm
hey mecene,
did you find a solution for this to work?
Title: Re: One domain name per language switch
Post by: andresvendedor on November 21, 2018, 03:19:41 pm
I have done something similiar. I remved the language swithcer and replaced them with links to the root of each language.