Linux 软件免费装

Plugin Name

开发者 gh3
更新时间 2008年8月20日 22:48
PHP版本: 1.5 及以上

标签

language multilanguage multi babel multi language

下载

0.63 0.64 0.65 0.70

详情介绍:

Babel is a plugin that allows you to write your blog content in multilanguage in an easy way, using simple tags in your post. With the latest release (0.70) babel is now able to localize permalinks and show to the end user the his/her language automatically (obviously if the language is supported). If you are interested in more info about this plugin point your browser to this page: http://p.osting.it/my-works/babel/

安装:

  1. Upload all the files in /wp-content/plugins/babel/ directory
If you want different languages, or flags you have to create two gif per each language called in this way: lang_tag.gif lang_tag_d.gif lang_tag is the tag that you can setup in babel.php file (for more info about add/modify languages read Faqs)
  1. Activate the plugin through the 'Plugins' menu in WordPress
  2. Place <?php babelize(); ?> in your templates
  3. You can start writing blog contents in multiple language using tags like: [en]post in english[/en] [it]post in italian[/it]

常见问题:

How to use?

You have only to write post, tagging each language: eg. [it]Italiano[/it] [en]English[/en] For titles, you have to write as normal title inside post, the one in the language you have set as default in babel.php file. Then you have only to scroll till Custom Fields and add: key: the short tag of the language ( eg. it or en, etc ) value: the title text

How to change default language?

You have to open babel.php file and set all the default value in arrayLang variable to 0, execpt for the one you want to set as default visible.

How to add a language support?

You can do following these steps: Open babel.php Look at arrayLang var Point your mouse between after this line: 1 => array ( "lang" => "it"�"default" => 0� "title" => "Italiano") Add a comma and press enter Add a new lang increasing the first number to 2, and setting all the info like: 1 => array ( "lang" => "fr"�"default" => 0� "title" => "French") The last thing you have do to, is to put inside the babel directory two images called in the same way as lang attribue in the array. Eg. If lang => "fr" we will have to name the two gifs like: fr.gif ( the active flag one ) and dfr.gif ( for the disabled one )

How to setup permalink localization support

First of all you have to open the functions.php file inside your theme, and add this: Now the system will be able to handle with localized urls like: http://p.osting.it/my-works/babel/ and http://p.osting.it/en/my-works/babel/ If you are using other languages, you will have to add these lines: $newrules['LANG/category/(.)$'] = 'index.php?category_name=$matches[1]&lang=LANG'; $newrules['LANG/tag/(.)$'] = 'index.php?tag=$matches[1]&lang=LANG'; $newrules['LANG/page/(.)$'] = 'index.php?paged=$matches[1]&lang=LANG'; $newrules['LANG/(.)$'] = 'index.php?name=$matches[1]&lang=LANG'; $newrules['LANG $'] = 'index.php?lang=LANG'; Per each new language. IMPORTANT, you have to substitute LANG with your lang tag.

How to localize page links/permalinks?

If you are using pages in your blog and you are interested in localize their links/permalinks too you will have to this line to your functions.php file in the babel_rewrite_rules function: $newrules['en/about$'] = 'index.php?pagename=about&lang=en'; And if you want to localize permalinks also for children pages, you will have to add a line like this: $newrules['en/about/(.*)$'] = 'index.php?pagename=about/$matches[1]&lang=en';

How to localize a link?

Menu localization is actually on alpha stage, so it could not work perfectly. Its usage is very simple, look at this example: <?php _b("testo"�"http://"�"it"); _b("text"�"http://"�"en");?>

How to localize a text?

It's very similar to localize a link, you will have only to omit the link value with something like: <?php _b("testo"�""�"it"); _b("text"�""�"en");?>

I got a trouble with titles, how to solve it?

I saw that some templates misuse the the_title function for the anchor title value too, and this generate some troubles with Babel. The solution to this problem is very easy, you have to edit a couple of your template files ( in particular single.php, index.php and page.php ). First of all you have to find this line: title="Permanent Link to <?php the_title(); ?>" and the replace with this one: title="Permanent Link to <?php echo strip_tags(get_the_title()); ?>"

problem how to fix ?

More problem is very easy to fix with a simple workaround, you have just to write a post doing this: `[it]Before more italian[/it] [en]Before more english[/en] [it]After more italian[/it] [en]After more english[/en]`