skriker

To byl ten slavný den!

författare - malyfred / 15. 3. 2005

To byl ten slavný den, kdy padlo číslo 100+1 mnou napsaných příspěvků. To byl ten slavný den, kdy WordPress verze 1.5 přišel mezi nás. To byl ten slavný den, kdy jsem

„…si chtěl koupit
komín který v poli zdál se
jiným zbytečný…”

To byl on!

P.S. Protože nic není bez chyb, tak ani nový WordPress – otestujte tedy prosím na těchto stránkách všechno co vás napadne, díky!

Polyglot

författare - malyfred / 22. 2. 2005 /
  • česky
  • english

Example

In a Rhodes tailor shop:
Order your summers suit. Because is big rush we will execute customers in strict rotation.

A sign posted in Germany's Black forest:
It is strictly forbidden on our black forest camping site that people of different sex, for instance, men and women, live together in one tent unless they are married with each other for that purpose.

This post is here to introduce the plugin called "Polyglot" – plugin for complete and easy localization of your blog into several languages. Polyglot is based on Language Picker. If you have any problem reading documentation of Language Picker can be helpful. I have developed it for my private use but some other guys/gals could be interested (hello Mihailo:o) as well.

I have fixed all bugs in Language Picker that I've found and added ability to automatically detect the visitor's preferred language and then choose the right translation for him/her. You can try it here – with this post. Example above should be in czech or english according to your selection or preferred language in your browser.

How it works

For example this post actually looks like this:


[lang_cs]Dva studenti…[/lang_cs]

[lang_en]In a Rhodes tailor shop…[/lang_en]

This post is here to…

And that's it. You can translate titles of the posts, pages, names of the categories etc. in the same way.

ISO codes

You are supposed to use [lang_xx] where 'xx' is the ISO code of the language. These can be found here: ISO codes

Language versions

If you put to your index.php (and single.php, search.php etc.) in your themes something like this:

<?php if(function_exists('polyglot_other_langs')) {
//display existing language versions of the post
polyglot_other_langs(' ','<ul>', '</ul>', '<li>', '</li>');
}?>

(must be inside of the WordPress loop) you allow your visitors to choose the language version of particular post (as could be seen above).

Flags

Name of the language or associated flag will be shown according to the value of $polyglot_settings['use_flags']. (Thx Mateusz Łoskot for inspiration)

Preferred language

Then you can offer your visitors to set preferred language for entire blog (as you see in my menu). It can be done by code like this:


if(function_exists('polyglot_list_langs')){
polyglot_list_langs(false);
}

that you put e.g. in your sidebar.php. Function polyglot_list_langs() accepts one optional parameter true or false that says whether names of languages or flags should be shown.

RSS

You can also offer RSS feeds in different languages:

<a href="<?php bloginfo('url'); ?>?feed=rss2&lang_view=en"> English RSS</a>

Last thing you have to do is to specify languages of your blog in polyglot.php. Basically – you just add ISO codes to the array $polyglot_settings['knownlangs'].

If there is no suitable language version of text present – then the default language version is selected. If even default language version is not there – then only parts that are not translated are shown.

Template localization

Because Polyglot changes dynamically prefered language of your blog – you don't have to do anything special to translate your blog except that everything in your templates that should be translated must be "gettexed". And appropriate .mo files must be in your wp-includes/languages directory. You can get them here: WP localization files and they should be renamed to xx.mo where 'xx' is the ISO code of certain language.

Time & Date

Time and date formats can be cusomized to fit the language traditions since the versin 0.8.

Permalinks

Permalinks are fully supported, and turned on by default, since version 2.0 was released

Comments

The version 0.8 has also introduced the ability to write comments on posts in more language versions. Your visitors must use [lang_xx] instead of <lang_xx>.

Other useful plugins

You can also try some other of my plugins: IImage Browser, IImage Gallery, IImage Panorama, JÄÅ Preview.

Known issues

  • You have to set WPLANG (e.g. define('WPLANG', 'en');) in your wp-config.php. Thank you Pete!
  • If you are using WP older than 1.5 – uncomment part of the code from line 125 and comment part from line 139.

Important

Since version 0.8 you can use [lang_xx] instead of <lang_xx>. That's useful for those using WYSIWYG editors.

Fixes

01.04.2008 – WP 2.5 compatibility improved
27.01.2008 – WP 2.3 compatibility improved (tags, links, initialization,…)
11.10.2007 – few RSS related filters added
27.05.2007 – some setcookie improvements
22.05.2007 – small improvements related to new features in WP2.2
29.01.2007 – version 2.0 released. Many new features and improvements added (permalinks among others).
24.03.2006 – original WP function trailingslashit doesn't work as intended so it has been replaced by polyglot_trailingslashit
20.01.2006 extended polyglot_the_date, now accepts $before & $after
extended polyglot_list_langs, now sets a class for the <li>s (language_item and current_language_item)
Thanks Jan for all these improvements!
07.01.2006 Tag [lang_xx] added
18.10.2005 Huge update – flags added, 'translate categories' plugin implemented etc.
25.5.2005 Polyglot is now using standard load_default_textdomain() function.
13.3.2005 Tag <lang_all> is since this moment optional – everything except translated parts is handled as <lang_all>
12.3.2005 Fixed problem with WP1.5 – thanks Matthias.

Download

polyglot2.5.zip.

default_gettext.zip – fully gettexed default theme. (thanks to Maira)

Let me know

I'd appreciate if you let me know that you use Polyglot on your web. You can also choose whether you want to be informed about new versions:

How to translate categories

There are two ways. At first you can write translations directly to the category 'name' using [lang_??] tags. But WordPress is limiting the name length to just 55 characters so you will have a problem to fit all translations inside. I'd recommend you increasing the length of 'name' column in 'items' table (WP <2.3 – 'cat_name' column in 'categories' table) in your WP database.

Second way is to add all translations of categories to your .mo files and Polyglot will try to translate them. It's tested with wp_list_cats() function.

Česká lokalizace Wordpressu

författare - malyfred / 19. 2. 2005

Pokud máte čas, pomozte prosím s finální lokalizací nového Wordpressu! Konečně se do toho hoši pustili s tou správnou vervou. Takže se stačí zaregistrovat zde: http://www.ubuntulinux.org/join_form, pak dostanete e-mail s heslem a překládat můžete začít zde: https://launchpad.ubuntu.com/rosetta/products/wordpress/wordpress-1.5/.

Tam si vyberete jazyk, ve kterém se cítíte jako doma a ono se vás to zeptá na e-mail a obdržené heslo. Pak už jen do kolonek vypisujete překlady daných spojení. Pokud nevíte – nechte překlad prázdný, pokud si nejste tak úplně jisti – zatrhněte „Needs review”.

Divná značka %s bude nahrazena podle kontextu skutečnou hodnotou, takže je třeba jí nechat i v překladu! Stejně tak se v dané frázi mohou vyskytovat HTML entity jako &lt; apod. Ty také prosím zachovejte na odpovídajících místech.

Díky.

IImage Panorama

författare - malyfred / 10. 1. 2005

This is my third plugin for the WordPress and I hope you will like IImage Panorama as much as IImage Browser and IImage Gallery which are used by thousands and thousands of WordPress fans.

In the age of digital cameras is very easy to create 360° panoramas in your computer. You can use software that you have got with your camera or Photoshop or AutoStitch (recommended) – but the question is: How to present these images on the web?

How to use it?

The IImage Panorama is the answer. When you install this plugin you can add panoramas to your posts as easy as first example shows:

<panorama>
<img src="http://someaddress/image.jpg" />
</panorama>

Click on the image and move the mouse. Only this example is "alive" others are just pictures.

"Full example" is here:

<panorama width="400" height="200" start="-145" speed="0.7" inside="false" outside="true" images="true" title="Go Go Go">
<img src="http://someaddress/image.jpg" />
</panorama>

example 2
  • width and height are self-explaining
  • start – starting angle of view (-180..180)
  • speed – "speed" of rotation (-360..360)
  • inside – shows inside menu (true, false)
  • outside – shows outside menu (true, false)
  • images – outside menu is made of images/buttons (true, false)
  • title – shows the title of the image

Default values are specified in iimage-panorama.php.

Java

The IImage Panorama uses free Java applet (PTViewer3.1.2) by Helmut Dersch so if you want to see anything you have to have Java enabled in your browser and you should tell this to your visitors too.

For advanced users

You can study PTViewer documentation and specify parameters of applet as you want. IImage Panorama understands this:

<panorama>
<param name="name" value="value" />
<img src="http://someaddress/image.jpg" />
</panorama>

Don't forget to try IImage Browser and IImage Gallery! If you want to have multilingual blog then try Polyglot.

Download

iimage-panorama1.0.zip

Installation

  • Download it:o)
  • Unpack iimage-panorama.php to your plugin directory
  • Unpack iimage_panorama directory to the root directory of your blog. Or to any other place, but then you have to change settings in iimage-panorama.php
  • Activate it and use it!

IImage Browser 1.4

författare - malyfred / 4. 1. 2005

I have fixed space encoding problem and you can create thumbnails anytime not just during upload.

More details and Download.

Sewage Plant In Bubeneč

författare - malyfred / 3. 12. 2004 /
  • english
  • česky
Sewage Plant

IImage Gallery

författare - malyfred / 1. 12. 2004 /
  • english
  • česky

This plugin for WordPress should help you to add simple but nice galleries to your posts. Look at these examples!

This code is the simplest gallery:

<gallery>
<img src="http://blabla/stop_the_evil.jpg" title="Stop The Evil!" alt="stop_it" />
<img src="http://blabla/oko3.jpg" alt="I See You Baby!" />
<img src="http://blabla/house_of_the_rising_sun.jpg" title="House of The Rising Sun" />
</gallery>

Result is clickable set of thumbnails where title and alt atributes of original images are used for thumbnails. Thumbnails are automatically created when you save the post. (with default settings specified in iimage-gallery.php)

Well, this is not really nice gallery, I'd rather specify size, crop, quality… for this gallery:

<gallery crop="true" crop_center="true" max_side="100" quality="95" stand_alone="false">
<img src="image1.jpg" />
<img src="image2.jpg" />
<img src="image3.jpg" />
<img src="image4.jpg" />

</gallery>

(All possible parameters are used here.)

Result – cropped low compressed images with size of 100 pixels.

You can change all default settings in iimage-gallery.php file:

before = '<div class="gallery">'
will be placed before every gallery

after = '</div>'
will be placed after every gallery

before_each = '<a href="%s" class="gallery_item">'
will be placed before each image
%s will be replaced with 'src', 'alt', 'title' in this order
this could be useful for something like this:
<a href="my-gallery.php?img=%s&alt=%s&title=%s">

after_each = '</a>'
will be placed after each image

cache_dir = '/thumb-cache/'
relative to your upload directory
this plugin will try to create it for you, but don't rely on it

recreate_when_updated = true
should be thumbnails recreated when post is updated?
maybe you'd rather create only new thumbnails?

default_quality = 90
0..100 – quality of JPEG compression

default_max_side = 100
largest side of thumbnail in pixels

default_crop = false
crop images to square thumbnails

default_crop_center = true
crop image to upper left corner or to the center?

ig_show_errors = true
if true – error message will be added at the end of your post

default_sharpening = 0
value = 0..100
0 means no sharpening at all
Be carefull about this parameter because harpening takes quite a long time and the script can exceed the time limit for running.

use_permalinks = true
if true, permalinks will be used instead of passing parameters to the gallery script in traditional way (= iimage-gallery.php/23/3/1/ instead of iimage-gallery.php?idpost=23&idg=3&idi=1). Should work on most servers.

Most of these setting can be overwritten for single gallery as is showen in second example.
I guess I don't have to teach you how to use CSS for creating your own look of your galleries:o)

It should work with JPEG, PNG and GIF files, but it seems that there is some bug in PHP getimagesize() function so it works, on my server, only with JPEG files. That is good enough in most cases:o)

Original files can be on any URL, thumbnails will be created from them and saved into your thumb-cache directory.

Important

If you are using any WYSIWYG editor you should use [gallery]…[/gallery] instead of <gallery>…</gallery> tags.

Relative paths of images can be used. The only requirement is to use paths that are relative to the URI of your blog.

Download:

iimage-gallery1.9.zip

iimage-gallery-integrated-template.php_ – template for stand-alone browser that inegrates the look of the browser with the rest of your web. Download it and rename to iimage-gallery-template.php

Other recommended plugins

Stand-alone browser

Since version 1.3 IImage Gallery has a stand-alone browser for your galleries. Try it here:

You can completely change the look of the browser in iimage-gallery-template.php. I would appreciate if you sent me your templates so I could offer them to other users. My e-mail address is at the bottom of this page.

You can turn on/off the stand-alone mode for every gallery:

<gallery stand_alone="false">

</gallery>

To set if stand-alone should be used as default or not – change $ig_settings['ig_default_stand_alone'] in iimage-gallery.php

Known bugs: co-operation between IImage Gallery and Polyglot is not perfect at the moment but I know about that.

Installation:

As any other plugin – download it, unpack it to you plugin directory and activate it.

You should manually create thumb-cache directory in your default upload directory. That's usually wp-content so you should create it there.

Don't forget to look at: Custom pattern examples for IImage Gallery

IImage Browser 1.2

författare - malyfred / 14. 11. 2004 /
  • english
  • česky

You can upload images and create thumbnails with IImage Browser!

Read more and Download

IImage Browser 1.1

författare - malyfred / 4. 11. 2004 /
  • english
  • česky

IImage Browser is better and better:o)
I've added new very useful feature – deleting of images. Try it now and let me know what would you like to get next time.

More details and download.

IImage Browser

författare - malyfred / 11. 10. 2004 /
  • english
  • česky

If you know very nice Image Browser plugin for Wordpress but you are still looking for something even more sophisticated – you should try my own version.

New features:

  • You can browse through the subdirectories.
  • I have added a lot of JavaScript code to allow you insert pictures to your post as easy as possible.
  • You can delete selected files from the server.
  • You can upload files to the server and create thumbnails.

Look at these examples:

Select image

We are at the bottom of the directory structure my_upload_dir/fred/zelkovice as you can see. First picture has a thumbnail as red T indicates. Full size of picture is accessible through the link.

Thumbnails are recognised by prefix. This prefix could be changed in iimage-browser.php.

Click on the picture you like and the hidden menu shows up.

Get the code

It's hidden by CSS so you don't have to load new page – it's fast and easy. Then you choose which code you'd like to get. Optionally fill the description and press Get the code. The code is generated to the text area where you can modify it. Finally Add it to the post!.

When you click on picture second time – menu disappears.

Maybe you'd rather delete these ****** pictures from the server – no problem. Look at this:

Delete images

Click twice and they've gone!

But sometimes you probably need to upload some files to the server. I've added new button for this.

Upload

And when you click on it:

Full upload menu

full upload menu shows up.

If you can use PHP function imagecopyresampled() on your server you can choose between two different methods for resizing of thumbnail.

Quality is used only for JPEG thumbnails.

For the images that don't have thumbnails yet is the same function for creating thumbnails offered at the bottom of their own menu.

create thumbnail

Other recommended plugins

Download:

iimage-browser1.5.2.zip – compatible with WordPress 2.0 & higher. Please note, that you must have WYSWYG editor turned off to be able to use IIB. (Go to your user profile and uncheck " Use the visual rich editor when writing")

Let me know

I'd appreciate if you let me know that you use IImage Browser on your web. You can also choose whether you want to be informed about new versions:

Installation:

  • Unpack iimage-browser.php to your wp-admin directory and iimage-browser-plugin.php to your wp-content/plugins directory.
  • (for WP version < 2)Check TWICE if “URI of this directory” of “Allow File Uploads” in “administration> options> miscellaneous” is FULL address like: http://domain/blblabla
  • Activate IImage Browser plugin in administration area.
  • When editing post – you should have Insert Image in upper right corner of your screen or "IImage Browser" button in your Quicktags area. Click on it!

Fix:

27.05.2007 Improved handling of non-image files
28.12.2006 Many fixes due to changes in WP 2.0
21.03.2006 Custom pattern added
03.02.2005 "Create dir" button added
02.01.2005 It's possible to create thumnails not just during the upload
23.12.2004 Fixed problem with wrong encoding of spaces
14.11.2004 Uploading of images added.
07.11.2004 Fixed version for 1.3 2004-11-02 or higher
04.11.2004 You can delete images with IImage Browser.
20.10.2004 I've added insert_image_placement.txt file to the archive, where is description how to change the placement of "insert image button".
13.10.2004 – $ib_set_title didn't work – it's fixed now

© 2004 - 2014 malyfred