Support » Plugin: Asgaros Forum » I have a bilingual website, how to get this forum change lang depending on page

  • Hello
    I want to create a page for the french forum, and a page for the english forum.
    Simply by chaging the asgaros forum language depending on the loaded page.

    There would be a part of the forum subjects in french another part in english.

    Is there a way to do that?

    I tried to load the text domain by doing this, but it’s a dirty way to do and anyway it seems it doesn’t work

    if ( ! is_dir( $dir = WPMU_PLUGIN_DIR . '/plugins/asgaros-forum/languages' ) ) { 
                    if ( ! is_dir( $dir = WP_PLUGIN_DIR . '/plugins/asgaros-forum/languages' ) ) 
                    $dir = null; 
            echo $dir; 
            load_plugin_textdomain( 'asgaros-forum' ,false , $dir );

    How would you do? thanks

    • This topic was modified 9 months, 1 week ago by nicobzz.
Viewing 1 replies (of 1 total)
  • Thread Starter nicobzz


    I have found how to do.

    I explain here how to do for those who need an answer.

    I put this code in functions.php in the “wp” action trigger (I guess it could have been put in the “init” action trigger but not for me as get_locale return the good language for me only after “wp” action (the locale depends of my current page (either a french or english page) which is loaded after init))

    `$locale = get_locale();
    if ( is_dir( $mofile = WP_LANG_DIR . ‘/plugins’ ) ) {
    $mofile .= ‘/asgaros-forum-‘. $locale .’.mo’;
    $mofile = null;
    load_textdomain(‘asgaros-forum’, $mofile );`
    This code unload the “asgaros-forum” textdomain, and load the one in the good language (either french or english)

    (I put a hook in order that get_locale return the language I have put on the current page or article).

    Best regards

Viewing 1 replies (of 1 total)
  • The topic ‘I have a bilingual website, how to get this forum change lang depending on page’ is closed to new replies.