site_url fail to work with language

edited August 2014 in Modules
i want to have the url such as http://localhost/cms/en/home

where http://localhost/cms is the path to my cms folder. en is the language i want to set. as i need to append site_url() in front all the links. I did by doing <?php echo site_url()en/home; ?>

which i think is not right, so i decide to use the build in language functions. i set the the language mode in my_fuel.php to $config['language_mode'] = 'segment'; and i changed config.php to $config['language'] = 'en';

however when i do <?php echo site_url()/home; ?> the en is not reflected in the url

according to http://docs.getfuelcms.com/helpers/my_url_helper , (boolean) $language sets the language parameter on the URL based on the "language_mode" setting in the FUEL configuration

Comments

  • edited 9:35AM
    Try adding the following to your MY_fuel.php file:

    // append the current language value to the site URL automatically
    $config['add_language_to_site_url'] = TRUE;
  • edited 9:35AM
    any chance to use "en" instead of "english"?
  • edited 9:35AM
    What language is used for the default URL (without the language segment)? We'll usually have the default language (english), use that URL instead of a language segment.
  • edited 9:35AM
    yes,what i want is actually "en" append to the url instead of "english"
  • edited 9:35AM
    In MY_fuel.php can you change the languages parameter to use "en" => "en" instead of "english" => "en"?
  • edited 9:35AM
    yes, but i noticed that if i am doing that is like creating a new language with setting of extra files. What is the reason of use "english" instead of "en" in the first place in fuel cms?
  • edited 9:35AM
    It is something we debated with for a while and may be subject to change in the future but it was to match the default language folder and language setting in the main fuel/application/config/config.php file which is "english".
Sign In or Register to comment.