Support » Plugin: WP Menu Cart » Language change

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Ewout


    Since your topic title is ‘language change’, I think the best answer to this question is to create your own .po/.mo file. This way you can not only translate the word items but also the link titles “start shopping” etc.

    If you really do want to rewrite it, the best way to do that is to use a filter in your functions.php

    add_filter('wpmenucart_menu_item_a_content', 'wpmenucart_change_items_text', 1, 1);
    function wpmenucart_change_items_text($menu_item_a_content) {
    	$pattern = array('/item</','/items</');
    	$replacement = array('monstertruck<','monstertrucks<');
    	$new_text = preg_replace($pattern, $replacement, $menu_item_a_content);
    	return $new_text;

    This is the easiest way to go about, it simply replaces the words item & items. Note the inclusion of <, the beginning of the span tag, to avoid the replacement to stop when the singular item has been found (which is part of the word ‘items’).


    I can translate your plugin to czech language, but I dont know how to open or create .po/.mo file… Can you help me with it?

    Plugin Author Ewout


    You open & create .po & mo files with Poedit (

    Go to the WP Menu Cart plugin directory and find the /languages folder. Copy the .po and .mo of one of the language files, for example Spanish (es_ES). Rename es_ES to cs_CZ. Now open the .po file with poedit and change the translations.
    That’s all!

    With poedit I can open only .po file. I changed one of languages to mine, then renamed it, uploaded back to folder, but now I cannot find where to change the default language of your plugin.

    I promise, that this mine last question 🙂

    Plugin Author Ewout


    Correct, with poedit you edit the .po file, but it also saves to the .mo file. You should upload both! Or actually, it’s the .mo file that is used, but it’s good to have both in the same place in case you ever want to redo the translation.

    Our plugin conforms to the WordPress language, so if your WordPress is in czech, the plugin should be in czech too, but only if it finds the .mo file of course!

    If you do have any questions, don’t worry that you said it was your last – we’ll do our best to answer 🙂

    Hello guys!
    Is it possible to help with my issue: (.po) files are added to WP Menu Cart plugin directory.
    WP language is set to Russian.
    But in main menu I still see only “Item’s “.
    my site is

    Plugin Author Ewout


    If I visit your site it looks like everything is properly translated. Perhaps you only needed to refresh the page/open in a new tab? WooCommerce AJAX is quite persistent so it ‘remembers’ the old translation until you do a hard cache refresh. Other than that the only thing I can think of is that you say you added instead of

    Plugin Author Ewout


    Hello Wudza,
    I just checked your site (it looks very different now) and downloaded your .po file. I think I’ve found the issue. In the plurals setting (catalogue > settings), you use the following rule:

    nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1;

    POEdit gives an error here, saying this is incorrect. I also noticed that you have three times the same translation for this word. The default for Russian is:

    nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);

    Something else I found is that you did not use the %d in the translation, but this is absolutely necessary – it stands for the number that is inserted there!

    On a final note, you are using WooCommerce Menu Cart but you’re posting here to the WP Menu Cart forum. WP Menu Cart is the best of the two (also for WooCommerce), and it includes Russion translations by default.

    Let us know if you have any questions!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Language change’ is closed to new replies.