Support » Plugin: Transposh WordPress Translation » Custom CSS file for translations…

  • Hi,

    I have been trying with no luck to get a custom css file loaded on the translated pages as I need to change some fonts.

    I found this on the transposh site which would apparently do the job but I get a unexpected parse error when I add it to my header template:

    <link rel=”stylesheet” type=”text/css” media=”all” href=”<?php bloginfo( ‘stylesheet_url’ ).’-‘.$my_transposh_plugin->>target_language; ?>” >

    What I am doing wrong??


Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Ofer Wald


    Seems like you have a redundant > in your $my_transposh_plugin->>target_language

    which should have been

    however, the more updated and appropriate way would be calling

    so you’ll have:
    <link rel=”stylesheet” type=”text/css” media=”all” href=”<?php bloginfo( ‘stylesheet_url’ ).’-‘. transposh_get_current_language(); ?>” >

    Good luck 🙂

    Hi Ofer,

    Just tried the new line:
    <link rel=”stylesheet” type=”text/css” media=”all” href=”<?php bloginfo( ‘stylesheet_url’ ).’-‘. transposh_get_current_language(); ?>” >

    I just get the same css file called no language code.

    But I tried adding <?php echo transposh_get_current_language(); ?> and I get the language code come up. How would I add that to call the css file?

    Thanks for help on this

    Plugin Author Ofer Wald


    I see no reason this won’t work, but you can always change the string that I wrote there to three different lines, one of which will be yours.

    I also need somehow to get somehow from php if not for each language getting different name then at least language code echo like en or es or ca or ru or de or something to what i can change file name and i tryd

    <?php bloginfo( 'stylesheet_url' ).'-'. transposh_get_current_language(); ?>
    <?php "transposh_get_current_language(); ?>" ?>

    and it gives only

    is somehow in php possible to get echo something like widget does en or de or some other transposh language code or somehow make condition [tp mylang=”y” lang=”en”]csseng.css[/tp][tp mylang=”y” lang=”de”]cssgerman.css[/tp][tp mylang=”y” lang=”lv”]csslatviski.css[/tp]


    Plugin Author Ofer Wald


    bloginfo is a function that directly does the echo.

    I am not sure what are you trying to do exactly, but you are using the wrong function.

    also, to your second line, it makes no sense.

    <?php echo transposh_get_current_language(); ?>

    well here how it looks in php

    <?php echo transposh_get_current_language(); ?>
    <?php bloginfo( 'stylesheet_url' ).'-'. transposh_get_current_language(); ?>
    <?php "transposh_get_current_language(); ?>" ?>

    and result in firebug

    <?php echo transposh_get_current_language(); ?> also not working
    tomoorow ill buplicate my server and give you login for tests

    Plugin Author Ofer Wald



    I am not going to log into your site for tests, because I don’t need to, I see your coding error right and clear.

    instead of using get_bloginfo, you are using bloginfo (yes, took me a better part of a minute to find out)

    But since I see you will need this spelled out, here it is:
    <?php echo get_bloginfo( 'stylesheet_url'). '-' . transposh_get_current_language(); ?>

    Next time, I will answer much more slowly, giving you the time to resolve this by yourself.

    ps. this will put the -<lang> after your css, probably resulting in things line style.css-es, this can be fixed really easy with basic string manipulation functions, you’ll manage.

    I think this server has problems now. I refresh and it shows sometimes 3 my posts sometimes just 1.

    And Ofer Wald sorry 🙂
    Now i didnt see that it worked for me in screenshot also already couse lang code was just before http just didtn saw. Thx now this is great that we can get lang code and different files to be shown for each lang. We ask couse we cant resolve but when resolved others find answer.
    THX 🙂

    Thaiso you needed echo in whole php function like starting with echo bloginfo Ofer Wald previous messege has answer for you.
    Both works:

    <?php echo get_bloginfo( 'stylesheet_url'). '-' . transposh_get_current_language(); ?>
    <?php echo bloginfo( 'stylesheet_url' ).'-'. transposh_get_current_language(); ?>

    This now is solved and can be added to transposh FAQ and some function can be made for transposh css name generating like if exist style(langcode).css else style.css.
    Well if its good method to divide in different csses.
    Otherwise theres some function coding needed or hardcoding like i did:

    Heres then example how it works for me:
    This gives lang code <?php echo transposh_get_current_language(); ?>
    ir your current lang in website is English then en if German then de if French then fr

    So i have language lv en ru so i made jpg`s:

    and code

    <a href="<?php echo home_url(); ?>/par-mums/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('parmums','','<?php bloginfo('template_directory'); ?>/images/m2_par_mums_<?php echo transposh_get_current_language(); ?>_over.jpg',1)">
    <img src="<?php bloginfo('template_directory'); ?>/images/m2_par_mums_<?php echo transposh_get_current_language(); ?>.jpg" alt="Par Mums" name="parmums" width="194" height="43" border="0"></a>
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custom CSS file for translations…’ is closed to new replies.