Support » Plugin: More-Lang » How to add apply_filters(“…”) to translate the text ?!!!

  • Resolved webtrongoi

    (@webtrongoi)


    Dear!
    I try to use More-Lang Plugin for translate my site and feel really Good, but it doesn’t work when I translate the text on my cpanel, I don’t know where to insert code:

    apply_filters(“morelang_translate_text”, $default_text)

    how to use it ?!
    Thanks!

    • This topic was modified 1 year, 1 month ago by webtrongoi.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author clivezhg

    (@clivezhg)

    Hi webtrongoi:
    To apply it, if the default text is in a theme, you need to insert the code in the theme to replace the default text(so you need to know a little about the WordPress theme development)
    I suppose you know the WordPress localization function:
    __( $text, $domain )
    They are similar.
    Thanks!

    Dear @clivezhg !
    Thanks for your kindly support! I try to add the code to my site look like this:

    <?php apply_filters(“morelang_translate_text”, $default_text) ?>DANG NHAP</h2>

    The default language is vn and I want to translate to English.
    I used the code above but it doesnt work.

    • This reply was modified 1 year, 1 month ago by webtrongoi.
    Plugin Author clivezhg

    (@clivezhg)

    Hi webtrongoi,
    The ‘$default_text’ is a PHP variable here.
    In your case, you can use it this way:

    <?php
    echo apply_filters('morelang_translate_text', 'DANG NHAP');
    ?>

    Or this way:

    <?php
    $default_text = 'DANG NHAP';
    echo apply_filters('morelang_translate_text', $default_text);
    ?>

    Regards!

    • This reply was modified 1 year, 1 month ago by clivezhg.

    Thank you @clivezhg, it’s work!
    All the best to you!

    Plugin Author clivezhg

    (@clivezhg)

    Thanks a lot for posting this.
    This reminds me I should have put more detail in the tips, I will do it in the next release.
    Best Regards!

    Plugin Author clivezhg

    (@clivezhg)

    The document was updated, and a more concise function was added, for the above case, now (Version 1.7.2+) it can be written in this way:

    <?php
    echo _ml_t( 'DANG NHAP' );
    ?>

    Please see “How to translate text without an in-place editor?” in the FAQ for more details.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to add apply_filters(“…”) to translate the text ?!!!’ is closed to new replies.