How to use language files in plugins?

Basically read the source for the function load_plugin_textdomain(): function load_plugin_textdomain( $domain, $abs_rel_path = false, $plugin_rel_path = false ) Ignore the second parameter, it was deprecated a long time ago. An example from my plugin T5 Taxonomy Location: protected function load_language() { load_plugin_textdomain( ‘plugin_t5_tax_location’, FALSE, plugin_basename( dirname( __FILE__ ) ) . ‘/languages’ ); } The first … Read more

Locale switching with a “language” taxonomy

You might be interested in url_to_postid function Used as follows from your wpsx_redefine_locale function: $url = $_SERVER[‘REQUEST_URI’]; $postid = url_to_postid( $url ); Note that this does not return the post id for custom post types but the function is located in /wp-includes/rewrite.php and might be extended if needed. UPDATE: here’s your sample: function my_function(){ if … Read more

Can I have two different theme for two different language?

A WordPress Multi-site can handle multiple languages with individual themes and plugins activ. It’s like having multiple sites, one for every language, within one Installation. Every Site can have it’s own design, set of activ plugins and users. Read troth Method No. 5 on this Page for Details and Plugins that can help: http://codex.wordpress.org/Multilingual_WordPress

Is it possible to temporarily override the language setting?

Add a locale filter add_filter(‘locale’, ‘locale_filter’); and in the filter return the locale of your choice, function locale_filter($locale) { return “whatever”; } however, this needs to be done in context, your mail sending trigger will need to know the target user and get the locale from there, not very easy, although doable.

Multilanguage site with two domains

I recently answered a very similar question. Instead of having 2 separate websites, it’s far easier to install a translation plugin. The plugin will basically add extra fields or tabs in edit mode. For example, if you are editing a page titled “Home”, you will have a field for the English page title and then … Read more