Help on translating a few words with xlanguage (4 posts)

  1. turbodurso
    Posted 6 years ago #

    I am using the xlanguage plugin to translate my posts (great plugin btw). But at this time i need to translate a brief descriptive paragraph that is harcoded in the header template.

    I've tried the following and other things but i cant get it to work :

    <?php if (function_exists('xlanguage_current_language_code') && xlanguage_current_language_code() == 'en') { ?>
    	<p>bla bla</p>
    <?php }else{ ?>
    	<p>bla bla</p>
    <?php } ?>

    Any idea on how to make this work inside a template? thanks ...

  2. Copernicus
    Posted 6 years ago #

    I've been attempting to do the same thing without success.

    Reading the plugin site's discussion, there is a post pertaining to this issue within comment #120 and a reply from the plugin's author within comment #122.

    I've posted my own experiences with trying to hard-code such a solution within comments #552 and #553.

    As I mentioned, though, I have not been successful, so please post here and on the official site if you discover a working solution.

    I will do the same.

    Good luck to us both!

  3. gelkamar
    Posted 5 years ago #

    after trying odd codes with my poor php skills i found the solution!
    ther's an error in the syntax of the plugin's author if statement:

    this is what the author suggests
    if (xlanguage_current_language_code == "cy") { ... }

    this is the working one
    if (xlanguage_current_language_code() == "cy") { ... }

    i found it trying to echo the variable xlanguage_current_language_code

    hope it works for you as it did for me..
    happy coding ;)

  4. baalam
    Posted 5 years ago #

    THX gelkamar!

    Worked like a charm!

Topic Closed

This topic has been closed to new replies.

About this Topic