Tag Info

Hot answers tagged

12

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 = ...


11

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 = ...


11

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 ...


10

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; ...


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 ...


8

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: ...


5

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

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

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

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/


4

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 ...


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

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

If your just looking for a way for your site to be viewed in other languages I would defiantly recommend using Google Translate Tools. I just add it to the theme: <div id="google_translate_element"><span id="trans">Translate: </span></div> You can hide the Google Logo and funky colors in your css: .goog-logo-link{display:none;} ...


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

How about using the qtranslate plugin?


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

See Installing WordPress in Your Language in the codex.


3

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


3

You have to replace the call to BBpress’ language file. A good place to do this is a language specific file in your general languages directory. For Turkish it would probably be a file named tr_TR.php. This will be loaded automatically and only if it matches the language of your blog. It will not be overwritten. BBPress doesn’t use the function ...



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