• Resolved Ahni

    (@ahni)


    Hey. First, thanks for putting together such a great plugin. I’m really looking forward to using it.

    At the moment, I seem to be getting an error when I add the widget to my sidebar. In place of the widget, I see

    Catchable fatal error: Object of class WP_Error could not be converted to string in /home/…/wp-includes/functions.php on line 1381

    I’ve been searching online for a solution but couldn’t come up with anything. Any ideas?

    Also, is there any chance you could expand the FAQ about Theme translation? Eg, do I have to wrap all the text in my theme to something like

    ?php _e(‘Links’, ‘horizons’); ?

    I ask because so far only one term (comments) has been translated by the plugin. I’m guessing that’s right because most of my theme’s text is hard-coded) but I’m not sure.

    Thanks again.

    http://wordpress.org/extend/plugins/gts-translation/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter Ahni

    (@ahni)

    Hey. Ok, I’ve done a bit more searching and have a much better handle on theme translation (a good starting point: http://www.catswhocode.com/blog/how-to-make-a-translatable-wordpress-theme/ ) but I’m still a little confused about where I should put the .PO file(s)? Do they go into

    /plugins/gts-translation/translated_themes/

    As for the error, I have a bunch of plugins installed, so I’ll check if one of them’s interfering. A

    Plugin Author stevevls

    (@stevevls)

    Thanks for downloading and installing the plugin! I’m the author, and someone just pointed me to this thread. Sorry for the delay, but I’ll see what I can do to help.

    In regards to the error, can you tell me which versions of WordPress and PHP you use plus what other plugins you have installed? Also, if you have a stack trace in your server log, that would be very helpful as well. We haven’t seen that error before, so it’s probably some sort of conflict.

    And thanks for the feedback on the theme translation. Right now, it’s pretty beta and can still spit out unusable PHP code from time to time. We’re working on it, though… One challenge we have when translating the themes is that we want to leave the original theme completely alone so that we’re not messing with files except those under our plugin’s directory. Therefore, we opted not to use PO files because that would very much limit our reach…the vast majority of themes out in the wild are not set up for i18n.

    Our theme translation can get text in two places: text in the HTML portion of the PHP file or text that we can pull from certain “safe” PHP functions that include __ and a handful of others. Therefore, any text in the PHP portion of your template files must be wrapped with one of the functions from those classes in order to be translated. The FAQ only mentions __, but we also support the variants _e, translate, esc_attr__, esc_attr_e, esc_html__, and esc_html_e. I’ll have to update that. πŸ˜‰

    FYI, we may later switch over to a .PO-based system. In that case, the first step would be to copy and instrument the original template to make it i18n ready. But like I said, this part is very beta.

    Thanks again for the bug report and the feedback!

    Thread Starter Ahni

    (@ahni)

    Thanks for getting back, stevevls. No worries about the delay. Unfortunately, I’m not having much luck with this; but I did narrow things down a bit.

    First, I tried disabling all my plugins and removing a few custom functions (images, breadcrumbs and excerpts), but the error still showed up.

    Then, I found that, on my theme (which I designed from scratch) the error only occurs on the category, archive and home templates (it works perfectly on single) and only when the default language (English) is active. If I’m on a single page/post and I switch languages, then the widget works as intended (with all plugins active).

    Then I switch to the default theme (Twenty Ten) and… Voila! No error. So, I guess it must be something to do with my theme?

    I’m still gonna keep digging, cuz I really want this to work. I’ve been trying to provide translations to my readers for ages, and I think google translate is pretty insulting.

    Or maybe there’s a workaround? I was actually thinking how nice it’d be to have direct links to translated articles, sort of like what globalvoicesonline.org does. Is that possible?

    Thread Starter Ahni

    (@ahni)

    oh, forgot to mention, it’s PHP Version 5.2.6-1 and WP3.0.1

    Plugin Author stevevls

    (@stevevls)

    Hi again, Ahni.

    Thanks for digging in so much! Now you’ve got me quite curious about what’s going on here… Is there any chance you can provide me with your theme’s source so that I can play with it in my development environment? If so, please zip it up and send it to info at gts-translation dot com. If you can’t for whatever reason, that’s fine…we’ll just have to brainstorm about other ways to go about debugging this issue.

    In order to get the widget to properly output links, there’s lots of special logic dealing with what kind page we’re trying to show, so it’s not that surprising that it should work okay for some types of pages but not others. We’ve done most of our testing with the Classic, Kubrick, and Twenty Ten themes, but we also have a handful of test blogs with custom themes, but still this is the first time we’ve run across this bug. I’ll try to get it straightened out as soon as possible.

    Thanks!

    Plugin Author stevevls

    (@stevevls)

    Hello again.

    Thanks a bunch for sending your theme in…I was able to install it and get it working without too much trouble. What I found is that for some reason, WP is somehow identifying your homepage as a category page, and that was causing our code to fail when looking up the (non-existent) selected category.

    What I’ve been able to do is make our code a little bit less trusting of WP when examining it’s examining the type of page. I’ve released a new version (1.0.b3) of the plugin that should fix this issue for you. If you experience any more trouble after upgrading, please be sure to let me know.

    Thanks again!

    Thread Starter Ahni

    (@ahni)

    WP is somehow identifying your homepage as a category page

    Good work, stevevls! I completely forgot about that. I know exactly which category it’s looking for too, but I don’t know why the heck it’s calling it.

    In any case, I’ll update the plugin a little later today. I’ll definitely let you know how it goes.

    And thank you very much for all your efforts.

    Thread Starter Ahni

    (@ahni)

    darn, it didn’t work. I’m sure it’s because of that problem with the category though, so I’llget working on that now.

    Also, a small heads up, stevevls: the gts image isn’t working anymore. The link points to “logo_trans_sm.png” but I think it should be “logo_trans.png”

    wish me luck

    Plugin Author stevevls

    (@stevevls)

    Darn indeed! Are you still getting the same error, or is it something new? When I had your theme loaded up in my dev environment, I wasn’t getting any more error messages after making my changes. PHP and WP behavior can be so dependent on the environment, though, so it wouldn’t surprise me if something else came out of the woodwork for you.

    And thanks for the tip on the missing image…that was a recent addition that didn’t make it into source control. I just turned around another quick rev on the plugin that includes it.

    Thread Starter Ahni

    (@ahni)

    Yeah, It’s the same error message. But there is some good news: It’s working on the front page! It’s just happening in the news category (9) now.

    I wonder, if it’s no trouble, could you test my theme with the “simply-exclude” plugin? I’m using a bunch of different plugins but this is the only one that effects how categories are handled. It might’ve done something to my database. Meanwhile, I’m going to go through the wp-options table for references to the category.

    Plugin Author stevevls

    (@stevevls)

    Well, it looks like Simply Exclude is in fact the culprit. I was able to recreate the errors after installing it. It modifies the WP query object in a way that generally confuses (or I should say confused) my plugin. I’ve released a 1.0.b6 that changes some of the mechanism around how the translation URLs are created so that they don’t get mixed up by Simply Exclude (or other plugins that may change the WP query object). Let me know how it goes after the upgrade!

    Thread Starter Ahni

    (@ahni)

    hmm, that didn’t work either. Plugin or no plugin, It’s the same old error.

    I’m not sure what else it could be, stevevles. I’ve gone over my theme with a fine tooth comb but I just can’t find any problems. Maybe I’ll try omitting my functions again. Unless you have any other suggestions or workarounds? Even it’s messy, I don’t mind.

    Plugin Author stevevls

    (@stevevls)

    I don’t really know what else to try. Like I said, I have your theme plus Simple Exclude cooperating together in my development environment. There must be some other conflict on your production blog. Can you give me a brief re-cap of which pages are displaying the error? Also, can you try disabling all plugins except the GTS translation plugin? Thanks…

    Plugin Author stevevls

    (@stevevls)

    Hi Ahni. I just wanted to report that I was able to expose one version of this bug with further testing, and I’ve patched that case as well. The problem was related to multi-word categories. If that doesn’t fix your problem, then we can continue brainstorming. Thanks!

    Thread Starter Ahni

    (@ahni)

    Well done, Stevevls! It works! And good thinking, too; that never would’ve occurred to me.

    Ok, I’m going to mark this topic as resolved πŸ™‚ I think I should probably open another thread, though, cuz there seems to be a bit of a problem with the way URLs are being handled. I’m getting a bunch of 404s.

    Again, great work, and thank you for your efforts.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘[Plugin: GTS Translation] Catchable fatal error: Object of class WP_Error could not be converted to’ is closed to new replies.