Translate Upgrades

I’m making a new payment option for the upgrades plugin (iDeal via Mollie.nl) and since that is for the Netherlands I want to translate the upgrades plugin to Dutch.

To be honest: I have no idea how to start. I do know how to translate a plugin when there’s a .po file, but I have no idea how you make one of those things from scratch..

Could anyone point me in the right direction?

  • Hiranthi
    • Recruit

    I realized that a little too late, sorry..

    The codex explanation doesn’t make any sense to me (keep reading the same pages, and it does say what you should do, but not how.. – or there is and I just can’t find it) but I’ll just go with trial and error I guess :slight_smile:

    ## edit ##

    Searches on WP itself didn’t give the answer, but a search on google did :slight_smile: Just found it :slight_smile:

  • Luke
    • The Crimson Coder

    Glad it did.

    Honestly, other than providing lang strings to be translated, I can’t say I’ve ever had the need to actually translate a file since everything I’ve dealt with to date has been either straight English, or an environment where there are mixed languages and English was the common ground.

  • Hiranthi
    • Recruit

    Okay, I almost got the iDeal thing going. The only thing that just won’t work is the credits-update function (upgrades_user_credits_add).

    While I was looking into the function, I was wondering why there are 2 queries, when one would do just fine..

    function upgrades_user_credits_add($tmp_credits, $tmp_user_id){

    global $wpdb, $wp_roles, $current_user;

    $tmp_old_total = $wpdb->get_var("SELECT credits FROM " . $wpdb->base_prefix . "upgrades_credits WHERE user_ID = '" . $tmp_user_id . "'");

    $tmp_new_total = $tmp_old_total + $tmp_credits;

    $wpdb->query( "UPDATE " . $wpdb->base_prefix . "upgrades_credits SET credits = '" . $tmp_new_total . "' WHERE user_ID = '" . $tmp_user_id . "'");

    }

    The only query you need is (this query does work for me btw, the above function doesn’t..):

    $wpdb->query( "UPDATE " . $wpdb->base_prefix . "upgrades_credits SET credits = credits+" . $tmp_credits . " WHERE user_ID = '" . $tmp_user_id . "'");

    Is there a reason for the two-queries solution?

  • Luke
    • The Crimson Coder

    Is there a reason for the two-queries solution?

    I’ll point the blame to a lack of proper caffeinated nutrition. Improper blend, using generic off the shelf “coffee”, and so on.

    Once we get Andrew craving his own fresh roasted varieties, he should be back to normal. :smiley:

  • Hiranthi
    • Recruit

    Hmm.. for some reason I can’t get the translation to work.. In the ‘Writing a plugin’ page at the WP Codex it says that you should include a function. First of all I have no idea where to place it (before either of the gettext functions is called, but as late in the session as possible it says.. I have no idea where that would be in this plugin..).

    And I also don’t know – for sure – how to name the language file. I named it upgrades-nl_NL.mo (as in the example at WPC) and dropped in the mu-plugins folder, but since it’s not an ordinary plugin I’m not sure if that’s correct..

  • Hiranthi
    • Recruit

    Still haven’t been able to get the translation to work and for some reason my whole mu install is broken now..

    When I try to access /wp-admin/

    Fatal error: Call to undefined function get_admin_page_title() in /xxx/httpdocs/wp-admin/admin-header.php on line 23

    when I try to access the frontend

    Warning: require_once(admin.php) [function.require-once]: failed to open stream: No such file or directory in /xxx/httpdocs/wp-content/mu-plugins/upgrades.php on line 10

    Fatal error: require_once() [function.require]: Failed opening required ‘admin.php’ (include_path=’.:disappointed:usr/share/php:disappointed:usr/share/pear:’:wink: in /xxx/httpdocs/wp-content/mu-plugins/upgrades.php on line 10

    Changed everything back to what it was, but the error remains.. Has anyone got an idea of how this happened?..

    //edit

    To be clear: this happened while I was trying to get the Dutch translation of Upgrades to work

  • Qlof
    • The Crimson Coder

    Upping this old thread.

    I’m trying to translate some plugins and themes using poedit. I thought I’d start with edu-clean but the theme doesn’t seem to recognize the files at all. Everything looks good in poedit and i’m saving the files as sv_SE.po and .mo in the theme dir. I tried making folders named lang and/or language aswell and it doesn’t work.

    How did you do to do this?

    The perfect scenario for me is that the localization plugin locates them. Then I can translate at work :wink:. My company’s blocked the common ftp ports and I don’t feel like installing poedit there.

  • Andrew
    • Champion of Loops

    Hiya,

    Plenty of people have been able to translate the plugins in the past. I’m sorry to hear that you’re having so much trouble but I’m afraid translating really isn’t an area In which have a lot of experience.

    You’re more than welcome to keep discussing translating here in the forums but I need to ask you to pick a thread and stick to that one thread. This one of the very old threads you resurrected so I’m going to go ahead and close it.

    Thanks,

    Andrew