0

I have been developing a multilingual website using Drupal 6. The languages are English and Spanish. I want to have some different backgrounds and css for them. But both use just style.css.

How can I create different style.css file for them? For example style-sp.css for Spanish one and en-style.css for English one ?

Is it possible ?

2

you can do this in template.php: you have to copt css file in themefolder/css.

    function yourtheme_preprocess_page(&$vars) {
        global $language ;
        $lang_name = $language->language ;
        if ($lang_name=='en')
        drupal_add_css(path_to_theme(). '/css/en-style.css');
        elseif ($lang_name=='sp')
        drupal_add_css(path_to_theme(). '/css/style-sp.css');
        $vars['styles'] = drupal_get_css(); //  use drupal_get_css() to add new css
}

so you have one of css files related to current page language.

4
  • I copied and pasted your code and put my theme instead of 'yourtheme'. Cleared cache, but it doesn't work.
    – hd.
    Apr 12 '13 at 17:01
  • i 'm sorry. you are using drupal 6.i think you have to use 'yourtheme_preprocess_page'. let me know if it works. Apr 12 '13 at 20:26
  • I use preprocess_page function, it goes through it but doesn't add style file.
    – hd.
    Apr 13 '13 at 7:16
  • i edited code and tested by myself and it works. Apr 13 '13 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.