WordPress.org

Ready to get started?Download WordPress

Forums

Custom Sidebars
[resolved] How about a language selector for custom sidebars? (5 posts)

  1. Anointed
    Member
    Posted 1 year ago #

    I see you have just about all the bases covered for choosing when and where to place a sidebar, except I do not see any way to set a sidebar depending upon the language being displayed.

    There is a great plugin for multi-language websites at http://wpml.org and they actually go out of their way to make it easy for plugin developers to add support.

    In this case, you would have 2 functions to use. One function will get a list of all the languages used on the website, and the second function will get the current language being displayed.

    Having those 2 functions mean you can easily add in a language selector to the sidebar plugin and then have full support for multilingual websites.

    Their functions:
    1: icl_get_languages() is a function that will return an array of the active languages

    Array
    (
    [en] => Array
    (
    [id] => 1
    [active] => 1
    [encode_url] => 0
    [native_name] => English
    [language_code] => en
    [translated_name] => English
    [url] => http://siteurl/
    [country_flag_url] => http://siteurl/wp-content/plugins/sitepress-multilingual-cms/res/flags/en.png
    ) [de] => Array
    (
    [id] => 3
    [active] => 0
    [encode_url] => 0
    [native_name] => Deutsch
    [language_code] => de
    [translated_name] => German
    [url] => http://siteurl/de/
    [country_flag_url] => http://siteurl/wp-content/plugins/sitepress-multilingual-cms/res/flags/de.png
    )
    [el] => Array
    (
    [id] => 13
    [active] => 0
    [encode_url] => 0
    [native_name] => Ελληνικα
    [language_code] => el
    [translated_name] => Greek
    [url] => http://siteurl/el/
    [country_flag_url] => http://siteurl/wp-content/plugins/sitepress-multilingual-cms/res/flags/el.png
    )
    )

    #2
    if (ICL_LANGUAGE_CODE=='en')
    .......

    We are then able to use if/then statements because of the ability of the function above.

    So there you have it, the 2 needed functions to VERY EASILY add in another tab of custom language choices to work perfectly with the wpml plugin.

    If you are interested in adding in the support I would love to send a copy of wpml to you and work with you on this project as I kind of need it myself and I am not quite sure where to plug this into your plugin.

    http://wordpress.org/extend/plugins/custom-sidebars/

  2. TommyNation
    Member
    Posted 10 months ago #

    I need this functionality badly. The multi-language support in Custom Sidebars is not the best, especially with regards to category archives default sidebars... I hope you have time to work on this :)

  3. Hi there,

    Sorry about the delay here. I'll bring this up with the developer for you :)

    Thanks for your patience!

    Kind Regards
    Jack.

  4. mpmchugh
    Member
    Posted 7 months ago #

    I'd think that the Category Archives Default Sidebar assignment issue is the big problem. The assignments just need to know to "stick" when the language is switched.

    The actual content translation now actually works at the Widget level pretty well.

    I could see some use for a feature to assign a totally different sidebar when switching languages, but not as essential as the defaults issue.

    Thanks,
    Michael

  5. Hi there Micahel,

    Hope you're well today, sorry about the delay here.

    We have added multi-language support as a feature request for the plugin, though I don't currently have an ETA :)

    Thanks!

    Kind Regards
    Jack.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.