Translate menu labels with WPML
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.
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.)
…if you look at the file
wpml-config.xmlin root of WordPress SEO plugin folder, you’ll get an idea of how this works. Your plugin stores these menu labels in
Yes, the plugin stores the menu configuration in the
wp_optionstable. 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.xmldoes 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.
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.
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.
- 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.
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:
You will need to re-save your menu settings for the titles to show up in the translation interface.
Cool, it works!
You said “basic WPML support”, does that mean something is missing from this version?
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).
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.
It’s already in. Version 1.3 includes the partial WPML support discussed above.
- The topic ‘Translate menu labels with WPML’ is closed to new replies.