Support » Plugin: qTranslate X » CSS Class for font

  • On a multilingual dictionary we are using a language that requires a special font. This font looks odd for the English interface (besides we don’t want to wait for the download of the font if we’re just using English).

    It would be great if qTranslate would add a css class in the tag before the translation so that one could do something like this in the style sheet:

    .languagename {
    font-family: SpecialFont;
    }

    Philip

    https://wordpress.org/plugins/qtranslate-x/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Clause

    (@johnclause)

    New feature request? Do you mean front-end or back-end? Please, describe the specifications more accurately, preferably with specific examples.

    Yes, I guess this is a feature request unless you know some other way around this issue.

    So at the moment I need to add a span-tag with the class in front of each post for that specific language that has it’s own font.

    In this case I’m adding the class nuosu for the title (which will also appear as a menu item):

    Screenshot: http://i.imgur.com/nPo1mCr.gif

    This is the nuosu class:

    .nuosu {
    font-family: Nuosu SIL;
    }

    Philip

    Plugin Author John Clause

    (@johnclause)

    It seems to be a useful feature. I updated list https://qtranslatexteam.wordpress.com/desirable/ with this topic.

    If you are a developer, you are welcome to implement this feature and submit pull request at GitHub.

    @john Clause: OK, I’ve given it a go. This is a solution that should work for us, but you can judge much better if it will work generally for qTranslate X or if it needs more tweaking.

    In qtranslate-core.php, in the function qtranxf_use_language I replaced the line

    return qtranxf_use_block($lang, $blocks, $show_available, $show_empty);

    with

    return "<div class=lang-" . $lang . ">" . qtranxf_use_block($lang, $blocks, $show_available, $show_empty) . "</div>";

    This will add a div tag with a language class in front of the translated text. E.g. <div class=lang-en>some text</div>

    If that or something similar could be implemented, that would be awesome.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CSS Class for font’ is closed to new replies.