I think I’ll lose my hair over this…
Here’s my situation:
- I have a WP MU running on my server
- I have several sites in english
Now I want to add a blog in a different language under the same WP install, which will be using a twentyfourteen child theme, but I want everything else to stay in english.
I downloaded both the global WP and 2014 translations. I’ve tried to put one or both of these into my functions.php:
add_action('after_setup_theme', 'my_theme_setup');
function my_theme_setup(){
load_theme_textdomain( 'nwnsablog', get_template_directory() . '/languages');
}
add_filter( 'locale', 'my_theme_localized' );
function my_theme_localized( $locale )
{
return 'sk_SK';
}
I put these files: sk_SK.mo, sk_SK.po, [themename]-sk_SK.po, [themename]-sk_SK.mo
into the languages
folder in my theme root. I also put the first two into the languages
folder inside wp-content
.
At this point, it’s still all in english. If I change the define('WPLANG', 'sk_SK');
line in wp-config, most of the strings are translated, but it also translates them outside the theme, which I don’t want.
I could get to a point where a different part of strings was translated (I’m guessing they were theme specific), but I can’t reproduce that. Anyway, it wouldn’t be very useful, as it’s only a halfway translation.
Anyone can help?
I got back to this issue today and I solved it like a boss thanks to the Zanto plugin.
Just to recap, I was trying to translate the front-end of only one site from a multisite setup with the least possible hassle while leaving every other site unchanged.
All I did was copy the general WP language files into wp-content/languages and the translated theme language files into a languages folder inside the (parent) theme. I got those from the translated WP package I downloaded on the slovak WP website. Both are named sk_SK.po (and .mo).
By activating the plugin on the translated site, I could easily switch the language and that’s all I needed. Great plugin!