WordPress translation

OMFG that is the most stupid code I saw in core for some time. Don’t follow the comments there, if you want to use a different flavor of open sans just write a plugin that deregister the style and add the one you want to be used instead function replace_open_sans() { wp_deregister_style(‘open-sans’); wp_register_style(‘open-sans’, ‘http://fonts.googleapis.com/css?family=Open+Sans:300’); wp_enqueue_style(‘open-sans’); … Read more

Translate Plugin with french as base language

It is possible, but not good practice. Best thing would be to change all the strings to the english version and then translate it to french. Then you would be up to the standards. Since I do not have enough reputation points to add a comment, I hereby insert the link to a possible duplicate: … Read more

Adding a translation phrase to WordPress Theme

Here is an idea or two that you can pursue here: (CAVEAT: Untested) OPTION 1 In your template file (use a child theme if this is not your own theme), use get_locale in a conditional statement to check which language is set in WPLANG and then dish up the text according to the locale OPTION … Read more

Plugin translation not displaying

Ah ha! I found the answer, and it’s a really weird one. It just so happens that the particular strings I was trying to translate were the labels of required form fields, and looked like this: <?php echo ‘<label>’ . __( ‘Email *’, ‘cdashmm’ ) . ‘</label>’ ?> If I move the asterisk outside the … Read more

WordPress Localization error within return value

sprintf() can be used to break the string up so that the translatable string can be isolated from the HTML: function new_excerpt_more( $more ) { return sprintf( ‘<a href=”https://wordpress.stackexchange.com/questions/206823/%1$s”><span class=”readmore”>%2$s</span></a>’, get_permalink( get_the_ID() ), __( ‘Read More’, ‘your-textdomain’ ) ); } add_filter( ‘excerpt_more’, ‘new_excerpt_more’ );

Plugin localization persistance (woocommerce)

444 would not stop a file being deleted. Deletion observes the permissions of the containing directory only. Whether the file is writable is irrelevant, because you’re not writing to it. Other people have posted they results using the filter approach. I suggest you have a look through their follow ups. Please note that 1.x version … Read more

qtranslate loading the wrong language

Problem is that events callendar is inited before qtranslate, Tribe__Events__Main::instance() : // let’s initialize tec silly-early to avoid fatals with upgrades from 3.x to 4.x add_action( ‘plugins_loaded’, array( $this, ‘plugins_loaded’ ), 0 ); simple hack was to create a plugin named 1fix with code: add_action( ‘plugins_loaded’, ‘__fix_tribe_init’, 0 ); function __fix_tribe_init(){ global $locale; if(preg_match(‘/^\/ru\//’,$_SERVER[‘REQUEST_URI’])) { … Read more