WordPress.org

Support

Support » Plugins and Hacks » Translate menu labels with WPML

Translate menu labels with WPML

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Janis Elsts
    Participant

    @whiteshadow

    Correct me if I’m wrong, but isn’t WPML designed for translating static text? It doesn’t look like it would work for text entered by the user, such as custom admin menu titles.

    Hassan
    Participant

    @hassanhamm

    WPML is a complete multilingual website solution. It works for static as well as user-generated strings. Many plugins/themes support this already. For example, WordPress SEO by Yoast supports the translation of its admin texts that are entered by the user (such as titles for CPT archives etc.)

    Hassan
    Participant

    @hassanhamm

    …if you look at the file wpml-config.xml in root of WordPress SEO plugin folder, you’ll get an idea of how this works. Your plugin stores these menu labels in wp_options table, correct?

    Plugin Author Janis Elsts
    Participant

    @whiteshadow

    Yes, the plugin stores the menu configuration in the wp_options table. However, the configuration data is not a flat array with predefined keys like what WordPress SEO uses, but a tree whose structure and keys can change depending on menu order, menu item URLs and so on. wpml-config.xml does not appear to support dynamic keys.

    It might be possible to use icl_register_string() to translate the titles. I’ll need to look into this more.

    Hassan
    Participant

    @hassanhamm

    I was just going to tell you that icl_register_string() is your friend 😀

    If you contact WPML team through their Go Global program page, they’ll most probably help you out.

    Plugin Author Janis Elsts
    Participant

    @whiteshadow

    While working on this, I’ve been wondering: which menus do you want to translate?

    • All admin menu items, including defaults (like “Dashboard”, “Settings” and so on).
    • Only custom menus that you have created yourself.
    • Only menus with modified titles.
    Hassan
    Participant

    @hassanhamm

    • Default menu items are already translated into other languages. So if I am running a multilingual site (or running WordPress with one language that’s not English), I’ll have those menus already translated. So, yeah no need to translate those
    • If by custom menus you mean any non-default ones, including menus added by plugins, then many plugins support translations, but it’s good to be able to translate those if the language of my installation isn’t officially supported by the plugin
    • Menus with modified titles are the main reason I asked for this feature. I have plugins with menu items that are properly translated. When I modify the title of one, this new title now appears as I wrote it regardless of the current language of the WordPress UI

    So, I guess custom menus and menus with modified titles are needed here, but not WordPress default ones.

    Plugin Author Janis Elsts
    Participant

    @whiteshadow

    Custom menus already count as having modified titles, so that shouldn’t be too hard to implement.

    Okay, I’ve added basic WPML support to the development version of the plugin. Give it a try:
    http://downloads.wordpress.org/plugin/admin-menu-editor.zip

    You will need to re-save your menu settings for the titles to show up in the translation interface.

    Hassan
    Participant

    @hassanhamm

    Cool, it works!

    You said “basic WPML support”, does that mean something is missing from this version?

    Plugin Author Janis Elsts
    Participant

    @whiteshadow

    I called it “basic” because it only lets you translate menu items, but not the “Menu Editor” page itself (button labels, messages, and so on).

    Hassan
    Participant

    @hassanhamm

    Ah, I see. Well, that does not necessarily fall under WPML support, but rather just i18n support.

    Anyway, looking forward to the update!

    Thanks, thanks, thanks. I hope that it is included in next release.

    Plugin Author Janis Elsts
    Participant

    @whiteshadow

    It’s already in. Version 1.3 includes the partial WPML support discussed above.

    Plugin Author Janis Elsts
    Participant

    @whiteshadow

    Well, yes. Why would you expect them to be the same? The first link points to the development version which changes all the time, and the second one is a specific public release.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Translate menu labels with WPML’ is closed to new replies.