I am sorry but the loading of translations does still not work out of the box with v1.8. I found out the following issues after testing around with two different installs over 2 hours…:
The general loading of the function and hook does NOT work! I’ve tried every possible combination of the function with the init hook and all priorities (loading order), also placement of the function/hook at the beginning of the code, in between and so on. The result is always the same: no displayed translations or only a few but NOT ALL!
The only thing that works is to place the following at the beginning of the plugin code – in recipress.php around line 33 or so:
load_plugin_textdomain( 'recipress', false, basename( dirname( __FILE__ ) ) . '/lang' );
–> This works very well and displays ALL available translations no matter if I am in frontend or backend – all options pages, inline post metaboxes and the actual posts… 🙂
defined constant for path to lang folder does not work, you have to use something like in the loading call:
basename( dirname( __FILE__ ) ) . '/lang'
dirname( plugin_basename( __FILE__ ) ) . '/lang'
Both definitions work as of my testing…
in /php/meta_box.php, line 65 cannot be translated because of wrong gettext syntax, you have to wrap it in “sprintf”, and then use placeholders for the html code and link code, like this:
'desc' => sprintf( __( 'Click the plus icon to add another ingredient. %1$sManage Ingedients%2$s', 'recipress' ), '<a href="' . get_bloginfo( 'home' ) . '/wp-admin/edit-tags.php?taxonomy=ingredient">', '</a>' ),
–> this code works very well and was tested live by me 🙂
I really don’t know why the init hook for the translations does not work here, it’s really beyond me. I’ve searched the web high and low for this issue but couldn’t find any hint on that. Since the placing of “loading_plugin_textdomain” without function/hook does work very well and will do NO harm I suggest to use that and all may be happy 🙂
- The topic ‘[Plugin: ReciPress] Loading of translations still not working (v1.8)’ is closed to new replies.