Support » Plugin: Events Manager » some strings in Chinese translation .po file don't work

  • Resolved omegacoder


    some of the translation strings don’t work. namely, “Event Tags” and “search for events”

    I’ve looked at the dbem-zh_CN.po file and the translations are there (search for events = 搜索活动) But the chinese version doesn’t show up on chinese site. I’ve updated the .mo file also, tried the update from .pot file too

    The output code is:
    <input type=”text” class=”search_input” value=”<?php _e(‘search for events’, ‘dbem’); ?>”

    Is my mistake obvious to someone. I really appreciate any help. I’ve spend some time on this already!

Viewing 15 replies - 1 through 15 (of 31 total)
  • try Settings > Formatting > Search Form

    that only applies for the events list search filter. I’ve got mine as a sidebar (which is not part of events manager). Actually I just realized that maybe this is why the translation is not showing, because my code above is not in the events manager plugin where the .po, .mo files are.

    ill do some tests and report back for everyones information

    check out (see side bar), to see what I mean.

    Also, my translation for “Event Tags” isn’t showing, and this I believe is part of events manager plugin, which is not showing in chinese also

    Plugin Author Marcus


    NetWebLogic Support

    I haven’t ever specifically tested this, but I’d imagine it should work since you have the ‘dbem’ in there. However, given that the po/mo files take lines numbers into accounts (e.g. open up the po file in a text editor), I may be wrong.

    Maybe it’s because your string doesn’t match the translated ones for capitalizations?

    Try out dev version btw, it has some corrections to language translation functions. To update visit Events> Settings > General > Admin Tools

    yes you are right it should work. It’s all from the events manager plugin default, so I hadn’t changed anything there.

    I expected this to simply work. But it hasn’t. I checked the dbem-zh_CN.po file and it does contain the correct translations for relevant strings, but it doesn’t show up on my chinese version website when I call it in my theme, like this

    <input type=”text” class=”search_input” value=”<?php _e(‘search for events’, ‘dbem’); ?>” />

    I’m using a childtheme by the way, but I don’t see how this matters, I have other translations that work alright both in other plugins and this childtheme

    also maybe relevant, I’m using wordpress multisite, the main site is english and subsite chinese

    Does your EM installation is network activated and/or enable global tables mode ?

    yes, it’s network activated. what is enable global tables mode?

    ok, just checked no, it’s not in global tables mode

    Plugin Author Marcus


    NetWebLogic Support

    MS wouldn’t make a difference. Nor would a child theme. If it’s not within the plugin and the po/mo isn’t regenerated, then it won’t work.

    Try using get_locale() and then output the translations directly using an php if statement.

    Or, wrap this code in your own plugin and add your own language file 🙂

    well if I use the get_lcale() and output the translations that way, isn’t this a messy hack?

    I’ve regenerated the .po, .mo file many times without it working. Also within my theme, I have buddypress translations, so perhaps the translations will work still even if not in the plugin, I think you just have to referene the text domain e.g. _e(‘my text’,’buddypress);

    anyway, about this get_locale() hack can you provide some sample code to set me on the right track? although I have quite a few translations remaining, so this really would be a last resort

    when I echo my locale it always shows en_US

    echo $locale = get_locale();

    But I’ve set the language of my subsite to chinese, and it still displays the locale as en_US (settings > general, site language set to chinese)

    Plugin Author Marcus


    NetWebLogic Support

    If you’re already using custom code, the it wouldn’t be that messy of a hack, you’d do

    $string = 'english string';
    if( get_locale() == 'x'){
      $string = 'other language';

    What are you using to translate? get_locale() should show the current language WP is using, but maybe your language plugin has its own function to check the current language.

    Thanks marcus for all your assitance!

    For me, using get_locale() always output en_US, so I couldn’t use that. I don’t have time now to dig and find out why. I’m really disappointed I couldn’t get the translations through. I’ve tried regenerating the .po file many times, and I see the translation strings in the .po file. My .mo file is also regenerated, but they just don’t show on my website for some reason. Does anyone else have this problem? Is my poedit software buggy? No, it works for my own custom plugin. I would really want to the solution

    As to your suggested solution, I’m doing something similar now, although i’m a bit uncomfortable with these unclean quick fixes, because they really should be translated through the .po,.mo files, but as a practical solution, that’s what I’ll have to do – for now anyway

    For everyone reading this, I’ve used the following solution:

    my theme function file:

    global $blog_id;
    // using multisite, $blog_id=1 refers to main site
    switch($blog_id) {
    case 1:
    define(‘TXT_SEARCH_FOR_EVENTS’, ‘search for events’);
    // etc
    case 2:
    // etc

    So I put all the non-working translations in the case, the rest was successsfully translated in the .op, .mo files

    how would I change the language of the word “events” in the tab menu when you visit the buddypress group detail page. Is this from the database by default?


    Plugin Author Marcus


    NetWebLogic Support

    It’s not stored in the database. It’s not so straightfowrward to do for that one instance, but if you want to change the word Event etc. add this to your functions.php

    //Rewrite any gettext field
    function my_em_text_rewrites($translation, $orig, $domain) {
    	switch ($orig) {
    		case 'Events' :
    			$translation = 'your text here';
    		case 'events' :
    			$translation = 'your text here';
    		//add this for further translations, including singular/plural variations
    	return $translation;
    add_action ( 'gettext', 'my_em_text_rewrites', 1, 3 );

    otherwise, you should hook into the wp admin bar and change it that way (or if using BP, modify the $bp global)

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘some strings in Chinese translation .po file don't work’ is closed to new replies.