Support » Plugin: Bogo » Replace displayed languages' names in switcher

  • Resolved boesiger

    (@boesiger)


    Hi,
    I’d like to replace the displayed languages’ names in the switcher with abbreviations (e.g. ENG for English, etc.). I use the shortcode. How can I do this without touching the plugins’ files? I thought of str_replace in my theme’s functions.php, but I don’t know what bogo function to call to make it work. The site’s still local, so I cannot provide a link.
    My code:

    function adapt_bogo($lan) {
    	$lan = str_replace('English','ENG', $lan);
    	return $lan;
    }
    add_filter ('???', 'adapt_bogo');

    Thanks for any help!

    https://wordpress.org/plugins/bogo/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    You can use bogo_languages filter (in bogo/includes/functions.php) for the purpose.

    The filter that worked for me was ‘bogo_available_languages’.
    The ‘bogo_languages’ changed the display language only in the Admin area.

    The first changes the links $name, just what i needed. The display languages in the Admin area stays the same.

    Cheers!

    My code:

    function adapt_bogo($lang) {
    	$long = array("English", "Russian");
    	$short = array("EN", "RU");
    	$lang = str_replace($long, $short, $lang);
    	return $lang;
    }
    add_filter ('bogo_available_languages', 'adapt_bogo');

    Exactly what I was looking for!
    Many thanks, base1

    How can the flags be hidden to not be displayed anymore.
    To have something like En | De | Fr

    Thanks

    Thanks a lot for the solution. This exactly what i was looking for.
    i don’t know what i did wrong but i get the following error message:
    Parse error: syntax error, unexpected T_FUNCTION in .../functions-custom.php on line 49

    Does anyone have idea how to solve this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Replace displayed languages' names in switcher’ is closed to new replies.