Skip to:
Content
Pages
Categories
Search
Top
Bottom

Users profile not being translated by Polylang


  • Kenny Lajara
    Participant

    @kennylajara

    Hi, I have WP WordPress 5.4 with bbPress 2.8.3.1 and Polylang Pro 2.7 installed.

    All the forums, topics, replies, everything are correctly translated, except the user profile.

    I even attempted to manually register the slug but didn’t work.

    The code I used to try to register the slug was:

    /* Translate Users profile slug with Polylang */
    add_action( 'after_setup_theme','bbp_polylang_integration' );
    function bbp_polylang_integration() {
    	if ( function_exists( 'pll_register_string' ) ) {
    		pll_register_string( 'slug_users', '_bbp_user_slug', 'URL slugs' );
    	}
    }

    I tried with _bbp_user_slug and with users as well.

Viewing 4 replies - 1 through 4 (of 4 total)

  • Robin W
    Moderator

    @robin-w

    '_bbp_user_slug' => 'users', // User profile slug

    is definately the slug

    so is the context right – maybe ‘polylang’ which seesm to be the default?

    and possibly change it’s hook to ‘plugins_loaded’ to make sure bbpress and polylang have both loaded before firing

    but i’m guessing 🙂


    Kenny Lajara
    Participant

    @kennylajara

    I tried changing the hook and nothing happened. This is my code now:

    /* Translate Users profile slug with Polylang */
    add_action( 'plugins_loaded','bbp_polylang_integration' );
    function bbp_polylang_integration() {
    	if ( function_exists( 'pll_register_string' ) ) {
    		pll_register_string( 'slug_users', '_bbp_user_slug', 'URL slugs' );
    	}
    } 

    About this:

    so is the context right – maybe ‘Polylang’ which seems to be the default?

    I don’t really understand what you mean.


    Robin W
    Moderator

    @robin-w

    this

    Function reference

    suggests

    pll_register_string($name, $string, $group, $multiline);
    ‘$name’ => (required) name provided for sorting convenience (ex: ‘myplugin’)
    ‘$string’ => (required) the string to translate
    ‘$group’ => (optional) the group in which the string is registered, defaults to ‘polylang’
    ‘$multiline’ => (optional) if set to true, the translation text field will be multiline, defaults to false

    so maybe

    pll_register_string( 'slug_users', '_bbp_user_slug', 'polylang' );


    Kenny Lajara
    Participant

    @kennylajara

    Nope, it doesn’t work. This is used only for, like, categorize the strings.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar