Translate This 9.03.12

Comments // Written on Mar 12, 2009 // Net

In the latest release of Translate This I fixed a bug which affected wordpress installations that are not located in the root of your domain. This means that if your blog address is something like

http://my.domain.com/

everything worked fine, while if you have something like that

http://my.domain.com/myblog/

the old version would have returned a 404 error. This error was due to an absolute path used to indicate the iframe location and was fixed with the suggestions of Marco Battistoni.

Older Releases

As I didn’t publish anything about latest releases changes I will resume them below

9.03.11

In this release I added a very useful JS script that has the duty to hide the ‘Translate This’ icon on your editor when you move from visual to HTML mode. This is necessary as the script still do not support code editor for translation. I will try to realize that in the future but in the meantime I believe that is safer to disable the icon so that people do not try to translate in HTML mode.

I also improved the graphics inside the popup, moving elements and fixing some styles, and added language flags inside the selectbox. Icons have been realized by Icon Drawer and all the rights about them are their property.

9.03.09-1

This is a miny-minor release, needed to fix an incompatibility issue with contact-forms-iii. That was suggested by Rajesh in the comments .

9.03.09

In this release I fixed paths problem that where caused from the change of the plugin folder from translate to translate-this. That was my bad fault .

Translate This – Translate wordpress posts as you type!

Comments // Written on Mar 08, 2009 // Net, Open Source

Playing with APIs is very funny, especially if you can obtain a lot, coding a few. This time I realized Translate This a simple wordpress plugin using Google Ajax APIs for Languages to translate the post you’re writing, directly from wordpress administration interface.

It was easy to create the plugin but it’s also very simple to use!
In fact it just adds an icon in the toolbar above wordpress text editor. Clicking it will open a popup containing a select for the language you want to translate your text to and a quick preview of what you will obtain. You change the language from the select and the preview updates itself. When you’re satisfied you press save and your text is automatically replaced with the translated one. There are 42 languages in which you can translate your text.

That’s amazing in my opinion…. here is a quick screencast to show what I’m talking about

As I’m still waiting for wordpress to accept my plugin on their directory you can visit the dedicated page on this blog.

.

Translate This – Wordpress Plugin

Comments // Written on Mar 08, 2009 // Info

Quick Features

  • 42 languages
  • quick ajax real time translation
  • simple, clean and nice interface
  • completely integrated on the editor
  • easy undo

Get to know it

Translate This is a Wordpress plugins that allows users to translate their posts and pages directly from the input form.

After installing it you will be able to open the translation menu from both the edit and the add new pages for posts and pages. Inside the translation menu you will have the possibility to choose in which language you want to translate (42 languages availables) your text and a short preview of what you will obtain.

The language you’re writing on is automatically detected, so you don’t have to specify it and obviously HTML tags are preserved by the system.

After choosing the language the preview will update automatically in a few seconds, depending on your connection speed. After you read the preview and agreed it is a good result you can confirm the translation tool to substitute your text with the translated one. If you’re not satisfied you can just undo your latest action ( CTRL+Z on the text area ) and you will came back to your original post.

Step 1 - Write your Text

Step 1 - Write your Text

Step 2 - Get your preview

Step 2 - Get your preview

Step 3 - Translate in real Time

Step 3 - Translate in real Time

Step 4 - Get your Translation

Step 4 - Get your Translation

Licence

Translate This – Wordpress Plugin
Copyright (C) 2009 Andrea Olivato

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Preview It

Credits

Original flag icons have been realized by Icon Drawer

Download It

Please visit Wordpress Plugin Directory to browse trought version or directly download below

Stable

Download 9.03.12

Older releases

Download 9.03.11
Download 9.03.09.1
Download 9.03.09
Download 9.03.08

Changelog

9.03.12 Fixed bug wordpress installations which are not located in the root folder of the domain. More details – Many thanks to Marco Battistoni for this fix

9.03.11 Added flags to language selection Graphics improvement on popup When selecting HTML editor mode plugin will hide itself

9.03.09-1 Fixed compatibility issues with contactformsiii

9.03.09 Fixed paths problem with image and iframe

9.03.08 Initial Release

Install It

Just download the file, extract the .zip and upload the translate-this folder to your /wp-content/plugins/ folder.

Now login to your administration ( http://www.yoursite.com/wp-admin ) and choose plugins from your left sidebar menu.

Look for Translate This in the Inactive Plugins list and click on ‘activate‘.

You’re done!

Use It

For more usage information please read the USAGE INSTRUCTIONS

Using is even simplier then installing it. Just start a new article clicking on New Post ( top-left of the administration area), write something on your native language in the text area and then look for the flag icon located in the Upload/Insert row right before the text editor where you typed.

After clicking the flag a popup will appear, containing a simple select with all the languages supported by Google language tools. After the select you can see a preview of your text translated on the default language ( English ). If you want to translate your native post into any language just choose it from the select and allow some seconds to the script to update the preview.

After the script made its job, if you are satisfied on what it translated just press Send & Close which will translate the text into your editor and close the popup. If instead you want to close the window without making any change to your text just close the popup clicking on the big grey X at the top left of it.

Improve Wordpress .htaccess

Comments // Written on Mar 07, 2009 // Net

Url rewriting is very (very very) important for seo and Wordpress users can easily avoid ugly urls like ?p=43 using permalinks in their installations.

To achieve the result of a true rewrite (no index.php file in the url) wordpress requires apache mod_rewrite module, and uses an .htaccess file that has the only purpose to redirect everything that does not exists physically to your index.php file. The default htaccess file looks something like that

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Apart from the comments let’s see quickly what most important line means

  • <IfModule mod_rewrite.c>

This just checks if your apache server has mod_rewrite installed and enabled

  • RewriteEngine On

Enables the rewriting engine

  • RewriteBase /

Sets the base url for the rewrite rules

  • RewriteCond %{REQUEST_FILENAME} !-f

Checks that the path requested is not present on your server.  This means that the server will  redirect on the index.php just addresses that do not match any physical file.

  • RewriteCond %{REQUEST_FILENAME} !-d

Checks that the path requested is not present on your server.  This means that the server will  redirect on the index.php just addresses that do not match any physical directory.

  • RewriteRule . /index.php [L]

Tells the server to redirect anything to the index.php file.

Let’s do some examples to clarify how does it work exactly. Imagine that the following files are your wordpress directory content

index.php

somepic.png

So if an user come to your websites with this url

http://www.yoursite.com/an-article.html

he will be redirected to the index.php file which will show the article, as the file does not exist on your server.

If instead an user arrives to

http://www.yoursite.com/somepic.png

he won’t be redirected because that image exists. He will just see the image, and this is correct.

Now suppose that someones arrive in your page

http://www.yoursite.com/an-article.html

and that in your template there is an inclusion of a js script (not present on your server) called

myscript.js

Including a script is like making an other http request to the server so it’s just like if the browser opened this page

http://www.yoursite.com/myscript.js

Wordpress htaccess file, will redirect the user to the index.php as the JS does not exists!!

This means wordpress will try to treat that JS as an article and so it will search on its database for any article having that name.

This  means that opening http://www.yoursite.com/an-article.html with a missing js file has nearly the same weight of calling two pages!

This is a big problem when you got an heavy installation of Wordpress with a lot of traffic, because it’s like doubling the traffic.

Yes that’s obviously an human error that can be avoided as you should always check for every image,js and css to exist.

However I prefer being sure that such problems do not verify so I just added some more rules to my htaccess,before the file and directory existence checks.

RewriteCond %{REQUEST_FILENAME} !^.*\.png [nc]
RewriteCond %{REQUEST_FILENAME} !^.*\.css [nc]
RewriteCond %{REQUEST_FILENAME} !^.*\.jpg [nc]
RewriteCond %{REQUEST_FILENAME} !^.*\.js [nc]
RewriteCond %{REQUEST_FILENAME} !^.*\.gif [nc]

As you can guess it’s just an other check before doing the redirects. If the file requested is not a css, a js or an image (gif,png, or jpg) then do the redirect.

So if any user come to my website and opens a page which contains an image that is no more there Apache will just launch a 404 not found error but won’t weigh down the server.

So here’s my full htaccess file, I bet you just wanted to see that without the explanations uh?

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !^.*\.png [nc]
RewriteCond %{REQUEST_FILENAME} !^.*\.css [nc]
RewriteCond %{REQUEST_FILENAME} !^.*\.jpg [nc]
RewriteCond %{REQUEST_FILENAME} !^.*\.js [nc]
RewriteCond %{REQUEST_FILENAME} !^.*\.gif [nc]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Twitter Avatars on Wordpress

Comments // Written on Feb 03, 2009 // Net

A few days ago Smashing Magazine, one of my favourite daily readings,  pulicized a Wordpress plugin which is able to search the avatar of  a user both from gravatar and from Twitter.

As the gravatar one even the twitter avatar is searched by email address so obviously the user will be recognized just if he set the same email address he used on Twitter.

The plugin was originally realized by Ricardo Sousa and you can try it in this blog, leaving a comment to this or other posts.

The installation is quite simple, just like all the others wordpress plugin you need to download, extract and upload it to your /wp-content/plugins/ directory. Then you need to locate your comments.php under themes->editor and finally just add the code for the image inside the comment loop.

<span><span><?php twittar(size, placeholderimg, border, </span><span class="keyword">class</span><span>, usegravatar, rating); ?> </span></span>

For more informations, instructions and updates please read Smashing Magazine original post .

Hey Social – QuickSilver like Interactivity

Comments // Written on Jul 23, 2008 // Net, Open Source

Yes, it’s ture. There are a lot of plugins for Wordpress that let your users interact with Social Bookmarking sites, but as soon as I looked at Hey Silver, I started loving its new way of proposing content. Continue reading →

Voz Me – Listen to the Site!

Comments // Written on Jul 16, 2008 // Net, Open Source

Voz Me Today I get surprised, seeing how, with so much simplicuity it is possibile to create something so userful! Perhaps lots of people already know VozMe , a 5Kb plugin that in a few second transform any text on your webpages in a Mp3 file, to download or to listen to in streaming with the embed player.

Continue reading →

Software

Comments // Written on Jul 15, 2008 // Info