xLanguage (Wordpress Plugin)

Monday, January 21st, 2008

完全使用手冊 (1)

Complete Usage Guide (1)

This page focuses on the general usage and xLanguage configuration, while the next page will focus on the code modifying and APIs so to make everything work as a whole.

How to Use

The basic usage is already shown in the options page. One should first added some languages in the options page. Then one can use the toolbar which is available in the rich text editor to tag the text. For single line content, please adopt the single line filtering mode syntax.

Composing Hotkey

You can use Ctrl+Alt+1 (or 2, 3, etc…) to tag the highlighted text or whole paragraph as in the first (second, third, etc) language. Ctrl+Alt+0 to remove the tag. This should come very handy for keyboard-hotkey-lover like me. Last but not least, Ctrl+Alt+Shift+0 (or Ctrl+Alt+` for pre-WP2.5) to toggle the highlight mode.

Display Filtering

To hide all the posts, pages written in foreign language that reader cannot read, you should-

  1. Go to the Advanced page. Under Display Filtering section, enable this options.
  2. Rebuild the metadata index after enabling it. Otherwise it will has no effect over the existing post. It takes a few screen flickers if you have more than hundreds of posts.
  3. From now on if you perform further language related operation (like Add/Remove and Mix & Match), you should rebuild this index to reflect the latest changes, as reminded by the result confirmation.
  4. Note that you don’t have to rebuild the index for day to day operation like posting and editing.

Language Configuration

Simple binary bilingual configuration

Example: Blog in English and Spanish, while English being the primary.

  1. Add two languages.
    1. Code: en, Name: English
    2. Code: es, Name: Español
  2. Set en as default.
  3. Optionally add fallback for both language in the advanced page. i.e. en fallbacks to es, es fallbacks to en, with appropriate message.
  4. Done. Start blogging with two languages.
Biligual configuration with overlapping

Example: Chinese and a localized Chinese dialect like Cantonese. Cantonese reader can read Chinese but general Chinese reader cannot read Cantonese. Blog is mainly done in Chinese, and the page title, tags and categories are only written in Chinese.

  1. Add three languages.
    1. Code: xx-zh, Name: ”
    2. Code: zh, Name: Chinese
    3. Code: zh-yue, Name: Cantonese
  2. Set zh as default.
  3. In advanced page, do the following modification under the Mix & Match section
    1. xx-zh — Show: ”, Available As: ‘zh,zh-yue’, Position: 0
    2. zh — Show: ‘xx-zh,zh’, Available As: ‘zh’, Position: 0
    3. zh-yue — Show: ‘xx-zh,zh-yue’, Available As: ‘zh-yue’, Position: 0
  4. Optionally add fallback for the languages in the advanced page.
  5. Done. Start blogging. You may or may not tag the content with xx-zh when blogging, but would be useful if you upgrade to triligual later.
Triligual configuration with overlapping

Example: Blog in Chinese, a localized Chinese dialect like Cantonese and English. Cantonese reader can read Chinese but general Chinese reader cannot read Cantonese. Blog is mainly done in Chinese, and the page title, tags and categories are only written in Chinese and English. (Just like this blog!)

  1. Add four languages.
    1. Code: xx-zh, Name: ”
    2. Code: zh, Name: 中文|Chinese
    3. Code: zh-yue, Name: 粵語|Cantonese
    4. Code: en, Name: English
  2. Set zh as default.
  3. In advanced page, do the following modification under the Mix & Match section
    1. xx-zh — Show: ”, Available As: ‘zh,zh-yue’, Position: 0
    2. zh — Show: ‘xx-zh,zh’, Available As: ‘zh’, Position: 0
    3. zh-yue — Show: ‘xx-zh,zh-yue’, Available As: ‘zh-yue’, Position: 0
    4. en — Show: ‘en’, Available As: ‘en’, Position:1
  4. Optionally add fallback for the languages in the advanced page.
  5. Done. Start blogging. For Chinese content, tag the content with xx-zh. Or zh and zh-yue if you have written separated content for them.
Fallback and Mix & Match

One might ask in the overlapping example given above, why do we need an additional language xx-zh when zh-yue can be fallback to zh and vice versa. The reason is that, if a zh-yue user is reading a xx-zh post, no “zh” options will be shown in the xlanguage_post_other_langs() bar, but if you only relies on fallback, and did the post in zh, the same function will show the zh available as “other_langs”.

Search Engine Optimization

It might be beneficial to present a page with all content to the search engine crawler, so all your content are identified to be under one URL, instead of a few URL diluting the Google PageRank. And this can be done too!

  1. Add a third language, with locale code like ‘all’ (or anything that won’t collide with any other potential code in the world). Set it to be the Search Engine default.
  2. In the Advanced page, make the ‘all’ language only available to the Search Engine under Presentation section
  3. Under Mix & Match, for the language ‘all’, list all your languages in the ‘Show’ field, list nothing (empty) in the ‘Available As’, and set -1 in the ‘Position’.
  4. Now it’s done. You might try it out by modifying one of your User Agent string to a crawler one, such as ‘googlebot/1.0′. Firefox’s User Agent Switcher can take care of this task easily.

Beware that the search engine crawlers are recognized by using the reported User Agent line only, the detection logic is prone to have false positive though chance might be small (Actual User recognized as Search Engine).

After weighting the tradeoff, you might want to mark all the other languages to be not available to Search Engine to reduce duplicated content, by-

  1. In the Advanced page, under Presentation, uncheck the availability of Search Engine of those non-all themes.
  2. Verify again with your browser.

Permalink modification, Postfix or Prefix

If you have the Permalinks feature enabled in WordPress (Settings -> Permalinks), and I don’t see any reason why you don’t unless it’s not supported by your host, the language specifier would then appear as part of the link like …/lang/en, instead of in the form of query string “?lang=en”.

Since v1.3.0, You then have the choice to place the specifier at the beginning of the link (the Prefix mode), or the end of the link. (the Postfix mode). The prefix mode is the default for new installation, and presumably should work nicer with other plugins if you ever run into problem. It also looks better and more intuitive. However, it’s a new feature and if you have encountered any bugs due to this, please do let me know.

Parser (XHTML or Square Bracket)

Since v1.1.0, there are two parsers provided so that your content could be tagged in either way to have it recognized and extracted. Personally I prefer XHTML parser, which <span lang=”..”> works great and incorporate with the standard nicely, while Square Bracket (SB) use [lang_...]…[/lang_...] to tag the content, works equally good when XHTML is not an option. Here is the list showing how they are different besides the tagging code used—

  1. The XHTML parser uses HTML tag to tag the content, such that the code is not visible to the user and editor, as well as to the WP searching functionality.
  2. The XHTML parser requires strict XHTML to work on, otherwise the parser will fail and complain. Some plugins are known to generate invalid XHTML content that can mess up the parse. The SB parser does not have this problem.
  3. The XHTML parser relies on the XML parsing provided by PHP, which might not be installed at all. If that’s the case, SB is your only choice.
  4. The XHTML parser implementation is very sensitive to the actual PHP-XML parser implementation, which render it not working in untested PHP version. The SB parser is much more stable in this aspect.
  5. The XHTML parser can parse nested language tag, while the SB parser does not work with nested the SB tag.
  6. In composing mode, the toolbar for XHTML parser have better functionality such as highlighting (in Firefox and IE7 only), and set/unset function.

Currently, if the XHTML parser failed, the cause will be logged in the Parser Log. Please check the log from time to time to see which page is causing the problem.

Latest news available in category xLanguage (WordPress)

793 Responses to “xLanguage (Wordpress Plugin)”

Pages: [32] 31 30 29 28 27 26 25 24 23 221 » Show All

  1. 793
    tester Says:

    Hi,

    I’ve just installed the plugin but I don’ t really understand this message at all when I set up the permlinks options:

    “Options cannot be saved because:
    The permalinks supported mode must include the primary appending position.
    The Square Bracket Syntax must be consists of a-z, A-Z, 0-9, – (dash) and _ (underscore) only.”

    I choosed that on Primary Appending Position:
    ” Prefix looks like http://example.com/blogurl/lang/en/archives/123. This has better compability with other plugins”

    And that on Square Bracket Syntax:
    “/”

    Any HELP please???

  2. 792
    Carlo Says:

    This works:
    blablebli

    This does not work:

    blablebliblo blo blo

    Why?

  3. 791
    Zoran Says:

    After I edit an article with Windows Live Writer all the text in the article is shown, regardless of the language. I must open it in WYSIWYG editor in WordPress and save it from there. Only then it looks OK again.

  4. 790
    Alberto Says:

    Hi,

    We are using your plugin xLanguage. It works great!! but we have a doubt. Now we are using ‘ugly’ permalinks like ‘http://xxxxx/?p=123′, and now we’d like to use pretty permalinks like ‘http://xxxxxx/2010/02/17/sample-post/’. I have tried to do it, but the permalinks are not good, because use the full title (english|spanish) like this ‘http://xxxxxxx/2010/02/17/english title spanish title/lang/en’.

    Can I use your plugin with pretty permalinks like that? Please, explain me how.

    Thanks in advance

  5. 789
    wordpress, atahualpa, xLanguage and widget titles translation | web performance Says:

    [...] My site is implemented in wordpress. I use the very nice atahualpa theme from bytesforall and a special plugin for multilingual websites, xLanguage from Sam Wong. [...]

  6. 788
    Catapult Says:

    I am sorry the code wasn’t showed. Second try !

    Hi there!

    I found a bug on list_lang.php.

    I am using flags. Active flag is showed perfect but the “no active” flag is not showed, after debugging I found the problem.

    File: list_lang.php
    Original:
    <a href=\"\”>
    <?php
    Corriged:
    <a href=\"\”>
    <?php

  7. 787
    Catapult Says:

    Hi there!

    I found a bug on list_lang.php.

    I am using flags. Active flag is showed perfect but the “no active” flag is not showed, after debugging I found the problem.

    File: list_lang.php
    Original:
    <a href="”>
    <?php

    Corrected:
    <a href="”>
    <?php

  8. 786
    Alberto Says:

    We are using your plugin xLanguage. It works great!! but we have a doubt. Now we are using ‘ugly’ permalinks like ‘http://xxxxx/?p=123′, and now we’d like to use pretty permalinks like ‘http://xxxxxx/2010/02/17/sample-post/’. I have tried to do it, but the permalinks are not good, because use the full title (english|spanish) like this ‘http://xxxxxxx/2010/02/17/english title spanish title/lang/en’.

    Can I use your plugin with pretty permalinks like that? Please, explain me how.

    Thanks in advance

  9. 785
    Leandro Says:

    Yes. Seems that have some issues with Chrome.

  10. 784
    Zia Says:

    At first thank you very much the nice plugin. This really works great. However, I want to put the language switcher in the header (not as a sidebar widget). How can I do that. I guess, I have to edit header.php. Thanks

  11. 783
    Caliper Engineering Says:

    There’s literally hundreds of opportunities out there, including local groups, but I’m going to list some of the best online penpal sites and my experiences with them. Thanks alot for the plugin by the way. Appreciate it. Cheers

  12. 782
    TecnolONGia» Arxiu » Nova imatge de TecnolONGia Says:

    [...] Ja no faig servir Polyglot per a les traduccions sinó xLanguage, molt més potent i fàcil d’utilitzar. A més, he doblat el tema per tal que la interfície [...]

  13. 781
    Crane Hire Says:

    One of the best ways of learning a language is interacting with natives. There’s literally hundreds of opportunities out there, including local groups, but I’m going to list some of the best online penpal sites and my experiences with them.

  14. 780
    Jaume Says:

    Hello Sam and all the folks who are helping throughout the comments. First of all I would like to thank you for this great plugin and for the support you are offering.

    I have a question I couldn’t solve after going through the 770+ comments.

    I’m trying to apply the translation to widgets. It works fine with titles. It also works fine with text… while it is a single line text. But, what if the content of the widget is something more complicated, ie, a bunch of HTML with more than one single line? Could I use the “normal” text option, ie, the span tags? It seems I can’t, but maybe I haven’t done it properly.

    Any help out there? Any workaround?

    Thank you very much.

  15. 779
    Roberto Says:

    it works perfectly; just be sure to double check how the admin side works in chrome tho as i have spent many hours trying to figure out why the plugin wasn’t working and eventually i have tried to use in firefox and it was a browser issue, i’m talking about applying a language to the text from the admin panel, in chrome doesn’t let you do it while in firefox worked as a charm.
    Thanks a lot for you effort, it’s brilliant.

  16. 778
    Salut tout le monde « silverlight, flash, php et C++ Algorithme Says:

    [...] fois trouver, il me fallait un plug-in pour avoir un site bilingue, parmi la multitude de choix, xLanguage a retenu mon attention, notamment car il permet de traduire les menus et les titres en plus des [...]

  17. 777
    Diana Calvario Says:

    I cannot upload the widget to my navbar … it simply will not accept it … any idea why?

  18. 776
    Printing Birmingham Says:

    This plugin works by inserting W3C standardized tag in the post content, and a XML parser will be involved to extract them when served, extracting all elements with the matching lang=”..” tag. The permalinks and RSS feeds are also presented correctly. For single line data such as post title, a special but simple syntax is introduced.

Pages: [32] 31 30 29 28 27 26 25 24 23 221 » Show All

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Subscribe without commenting