Tag Info

Hot answers tagged

11

By far the best (easiest) way is to use the locale filter (inside get_locale()). First set up a quick function for retrieving a different language to use on the locale filter. /** * A function returns with returns the user's selectd locale, if stored. */ function wpse35622_get_new_locale($locale=false){ $new_locale = ...


10

You must use the qTranslate native functions to do your job. Use qtrans_use, that is the function that do all the job in qTranslate. It's defined in qtranslate_core.php, line 747 function qtrans_use($lang, $text, $show_available=false) Use it on the raw content of the post! Try this code: <?php $id=47; $post = get_page($id); $content = ...


10

The best way is without plugin - i set WP3.0 with multisite; the first blog is a dummy to rewrite the uesers to right blog with his language, a small script in the theme to rewirte ro the right language; i see in the browser-language of the users and rewrite; the second is the default blog, the third blog is another blog and so on - olso it is possible to ...


9

There is a second argument in the __() function. It should be set to the domain you are are using for your plugin or theme. In the examples below I use 'text_domain'. Your domain string should be unique. It should not match any other domain string. Not using a text domain argument defaults to 'default' the WordPress domain name. See the link for more ...


8

In wp-includes/l10n.php you will find the function get_locale(). It offers a filter; you can set the language and ignore the constant: function get_locale() { global $locale; if ( isset( $locale ) ) return apply_filters( 'locale', $locale ); // WPLANG is defined in wp-config. if ( defined( 'WPLANG' ) ) $locale = WPLANG; ...


7

I got it now , After searched many resources : function lang_support() { return array('en','fr'); // Add your support lang-code (1st place is a default) } function rewrite_lang(){ $langs = lang_support(); foreach($langs as $lang) { add_rewrite_endpoint($lang,EP_PERMALINK|EP_PAGES|EP_ROOT|EP_CATEGORIES); } } ...


6

I use on the root site a small theme for redirect to the languages. A very small theme for locate the language of the users and redirect to the blog of this language. <?php // Browsersprache ermitteln function lang_get_from_browser($allowed_languages, $default_language, $lang_variable = NULL, $strict_mode = TRUE) { // $_SERVER['HTTP_ACCEPT_LANGUAGE'] ...


6

I would like to recommend WPML, I use it on all of my bi/multi-lingual projects. It has great support and it makes WordPress truly multilingual, instead of only your content. The latest addition is the media module, which takes care of the images you upload to Posts and Pages. No need anymore to upload them for each language separately, the plugin now ...


5

Have you seen http://wordpress.org/extend/plugins/wp-native-dashboard/? I think it does exactly what you are asking. Also 'interesting' is http://wordpress.org/extend/plugins/in-their-language/ which attempts to set the locale automatically based n browser settings.


5

Ok, finally got to the core of WP Native Dashboard basic concept and it's working now. The file is being used as a mu-plugin, and whenever I have to work in the site I rename it from set-user-locale.phpa to set-user-locale.php, and then back again. Thus activating and deactivating without the plugin being on the client's sight. [update] Following kaiser's ...


5

First, read this Codex page about translating WordPress. You have to create a language file to put into your language directory, do this by following the next steps: I assume you want to use poedit since you talk about a .po file download poedit File > new catalog In the first tab, fill in the fields, the most important ones are Language, in your case: ...


4

As you said per page/post basis, this would work for each post add_action('wp_head', 'add_link_in_head'); function add_link_in_head(){ global $post; if(!empty($post)){ $alternate = get_post_meta($post->ID, 'alternate', true); $hreflang = get_post_meta($post->ID, 'hreflang', true); if(!empty($alternate) && !empty($hreflang)){?> ...


4

You can use the qtrans_getLanguage() function. $currentLang = qtrans_getLanguage(); return the current language. See this link for an example. See the offical docs for developer here


4

load_theme_textdomain() returns TRUE on success and FALSE if no file was found. For debugging try the following change: function my_theme_setup(){ $path = get_template_directory() . '/languages'; $result = load_theme_textdomain('my_theme', $path ); if ( $result ) return; $locale = apply_filters( 'theme_locale', get_locale(), ...


4

If you can settle for a page refresh, redefining the WPLANG constant could be an option. I'm doing that on two sites with multilingual content where the multilinguality plugin fails to trigger UI translation.


4

_e() will translate the text passed as a argument to the language your site is currently set up to use (if the translation exists). Anyway, don't do that. Use it for text visible on the website, not for IDs/classes etc. To create context based css rules, simply add the WPML language ID as a body class: add_filter('body_class', 'wpml_body_class'); function ...


4

I'd look into qTranslate. I haven't ever used it, but it's the only free alternative to WPML that I've ever seen. That being said, I'd suggest you just pony up the $30-80 for WPML. It's by far the best-maintained and cleanest multilingual plugin you can get and it's absolutely dirt cheap, considering what you get. And with their (very reasonable) pricing ...


4

I ended up having to manually detect the language, here's how I solved it: <?php if (ICL_LANGUAGE_CODE == 'fr') { // display the menu en francais wp_nav_menu( array( 'menu' => 'Navigation principale', 'theme_location' => 'primary', 'container_class' => 'menu-header', 'menu_id' => 'menu-primary-navigation' ) ); ...


4

I've built several multilingual sites in WordPress, and to be honest, WP just doesn't do it very well, even using plugins. Either plugins offer limited solutions that require a lot of work on the end-users' part, or they only offer limited languages. (Note that I'm ignoring plugins that offer automatic machine translations.) The best solution I've found so ...


3

I have no experience with the plugin whatsoever, but from a quick scout of their site, it looks like: ICL_LANGUAGE_CODE will give you the current language. Worth a try, anyway!


3

Wordpress has no bi/multi-language feature built in by default. Instead, by design it supports the content to be in one language (so not knowing language). Using multiple blogs for multiple languages might be a good adoption of that design. The other road would be to extend the site with Add-Ons like plugins and themes that have multi-language features ...


3

I have used qTranslate as well with success and seen it implemented in couple of blogs. but the problem with using any of the 2 plugins is that with the wordpress updates, you have to wait for the new releases of plugins versions then update. With other plugins, like a contact form, rating system or stuff like this , you can disable them temporary, find ...


3

Try <?php wp_reset_query(); ?> after each function. See Function Reference/wp reset query « WordPress Codex


3

See Installing WordPress in Your Language in the codex.


3

WPLANG effects the whole site not just the admin section, you can use it in conjunction with WPML. It basically sets what language you have translations for but you must include a languages folder inside wp-include with the appropriate .mo and .po files. You can also set WPML to use the default languages directory ( which is set up by defining the ...


3

how about qtranslate ? http://www.qianqin.de/qtranslate/


3

I always use Post Types Order which provides a simple drag n drop ordering Check it out http://wordpress.org/extend/plugins/post-types-order/


3

So far the best plugin that I have tested to order pages by language is CMS Tree Page View. It allows you to select the language in which to order pages. Ordering is done in a drag and drop tree view. http://wordpress.org/extend/plugins/cms-tree-page-view/


3

I just found this which I applied and works perfectly: If you have your blogs installed in subdirectories you could use this solution: if (strpos($_SERVER['REQUEST_URI'], '/enblog') === 0) { define ('WPLANG', 'en_US'); } else { define ('WPLANG', 'pl_PL'); } ... and so on. Good luck!


3

Ok, now that you know your final goal I can try to answer : first , A little background for other people who will read this and might wonder why this question exists (because it can help also in other cases ) the function get_page_by_title() does exactly what the name say . But qTarnslate , as well as other plugins , actually CHANGE the title in the DB . ...



Only top voted, non community-wiki answers of a minimum length are eligible