30th Jun2014

Using qTranslate with WordPress 3.9++

by Gyro

I've been a long time fan of Qian Qin's qTranslate plugin, which allows you to translate just about everything you need to have a multilinugal website running on WordPress.

Unfortunately, he seems to have fallen off the face of the earth since WordPress Version 3.9 came out, so installing the plugin will result in its automatic deactivation, as the only available qTranslate version has not been officially tested with any WordPress version newer than WP 3.8.1 :(

I've been waiting for an update for months now, and I have come to the realization that I may have to wait a lot longer. So, I decided to see what I can do with this plugin to make it work again. Turns out, there are two simple file modifications needed in order to make qTranslate work with WordPress 3.9.1, which is the newest WP version that is available while I am writing this post.

If a new WP version is released, come back here to check if this fix/hack still works, BEFORE you update your WP installation.

Should there be a newer version available than WordPress Version 3.9.1, please write a comment. I will reply with a status report asap!

qTranslate WordPress 3.9 Fix

Short Question: So, what is there to do?

Short Answer: You have to modify two files in the /qtranslate/ plugin folder (via ftp).

1. Modify qtranslate.php

change this:

define('QT_SUPPORTED_WP_VERSION', '3.8.1');

to this:
define('QT_SUPPORTED_WP_VERSION', '3.9.1');
which allows activating qTranslate up to WordPress version 3.9.1.

You could also do this:

define('QT_SUPPORTED_WP_VERSION', $wp_version);
which allows activating qTranslate on EVERY new WordPress version. Warning: qTranslate may be incompatible with future WordPress versions and break your website! I highly recommend the first option.

2. Modify qtranslate_core.php

change this:

function qtrans_dateFromPostForCurrentLanguage($old_date, $format ='', $before = '', $after = '') {
global $post;
return qtrans_strftime(qtrans_convertDateFormat($format), mysql2date('U',$post->post_date), $old_date, $before, $after);
}

to this:
function qtrans_dateFromPostForCurrentLanguage($old_date, $format ='') {
global $post;
return qtrans_strftime(qtrans_convertDateFormat($format), mysql2date('U',$post->post_date), $old_date);
}

And that's already all there is to it! :)

Enjoy!

p.s. You may want to add this to your functions.php, it will increase the width of menu items in the admin… these tiny input fields drove me insane! :crazy:

add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
.menu-item-bar .menu-item-handle {
width: 582px;
}
.description-thin {
width: 550px;
}
.menu-item-settings {
width: 602px;
</style>';
}

Sources:
http://wordpress.org/support/topic/the-qtranslate-editor-has-disabled-itself-because-it-hasnt-been-tested-with-you
http://alexander.kirk.at/2014/04/17/fix-qtranslate-with-wordpress-3-9/
http://css-tricks.com/snippets/wordpress/apply-custom-css-to-admin-area/

1585

26th Jun2014

VirtualBox – moving a VDI file and re-linking it to the Guest

by Gyro

virtualbox

Today I decided to move my vdi files to another partition.
So, I moved them and then started the Oracle VM VirtuaBox Manager to re-link the vdi files to the respective guest.First, I opened the settings of each Virtual Machine and deleted the "old" hard disk under "Storage".Then I clicked on "Add Attachment", selected "Add Hard Disk" and "Choose existing disk", and then selected the vdi file.

Next came a very strange error:

The Problem

Cannot register the hard disk ‘FULL PATH TO NEW LOCATION OF VDI' with UUID {UUID OF THE VDI} because a hard disk ‘FULL PATH TO OLD LOCATION OF VDI' with UUID {UUID OF THE VDI} already exists in the media registry (‘/home/user/.VirtualBox/VirtualBox.xml').

This confused me pretty good, as I knew for a fact that I moved the vdi, so it did not exist at the old location anymore. I also had no clue what this media registry was supposed to be, and before opening that xml file and messing around with it, I decided to see if others had this issue before.

After a bit of google-ing, I found the solution in the VirtualBox forum:

Even though the thread was started on 2. Mar 2009, 16:43, some kind soul decided to register to the forum to make one single post to the forum in this thread on 21. Dec 2012, 22:00 (Christmas spirit?) with the simple solution to this problem.

Hi there,

I had the same UUID problem and a very easy fix worked for me. I went File>virtual media manager. I found the vdi file that was giving me issues. Selected it and removed (though it was showing up as inaccessible). Then started the VM again and selected the file from my local hard-disk. That was it!
Hope this works for you too. :)
Om

So, to summarize with a bit more clarity:

The Solution

1. Open the Oracle VM VirtuaBox Manager
     Click on File -> Virtual Media Manager (or Ctrl+D)
2. Delete the hard disk entry in question (select and press "Del" on keyboard)
3. Open "Settings" of the Virtual Machine, go to "Storage", click "Add Attachment", select "Add Hard Disk" and "Choose existing disk", then selected the vdi file and you are done.

Enjoy :)

268226