WordPress.org

Ready to get started?Download WordPress

Forums

Transposh WordPress Translation
Custom CSS file for translations... (9 posts)

  1. thaiso
    Member
    Posted 1 year ago #

    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??

    Thanks

    http://wordpress.org/extend/plugins/transposh-translation-filter-for-wordpress/

  2. Ofer Wald
    Member
    Plugin Author

    Posted 1 year ago #

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

    which should have been
    $my_transposh_plugin->target_language

    however, the more updated and appropriate way would be calling
    transposh_get_current_language()

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

    Good luck :)

  3. thaiso
    Member
    Posted 1 year ago #

    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

  4. Ofer Wald
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. Kangarooo
    Member
    Posted 1 year ago #

    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
    http://websitename.com/wp-content/themes/themename/style.css

    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]

    ?

  6. Ofer Wald
    Member
    Plugin Author

    Posted 1 year ago #

    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.

    try
    <?php echo transposh_get_current_language(); ?>

  7. Kangarooo
    Member
    Posted 1 year ago #

    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
    http://postimg.org/image/xnaakrhl5/full/

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

  8. Ofer Wald
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    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.

  9. Kangarooo
    Member
    Posted 1 year ago #

    I think this WordPress.org 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:
    m2_par_mums_lv.jpg
    m2_par_mums_en.jpg
    m2_par_mums_ru.jpg
    m2_par_mums_lv_over.jpg
    m2_par_mums_en_over.jpg
    m2_par_mums_ru_over.jpg

    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>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic