Solved the translation issue
-
Hi,
I was looking for an email to send this suggestion to iThemes Team. I haven’t found it, so I write here.
I’m using iThemes Security v4.5.10 and I solved the translation issue correctly.
The modified file is ‘better-wp-security\core\class-itsec-core.php’.
My first step was to change the ‘load_plugin_textdomain()’ function:
– (older)load_plugin_textdomain( 'it-l10n-better-wp-security', false, trailingslashit( $itsec_globals['plugin_dir'] ) . 'lang' );
– (newer)load_plugin_textdomain( 'it-l10n-better-wp-security', false, trailingslashit( dirname( dirname( plugin_basename( __FILE__ ) ) ) ) . 'lang' );The problem here was that it had to call the absolute path and it has to be the relative path.
–
The second step was to move this line before to declare ‘$this->pages’ variable, because inside this variable there are strings to translate.
Once the translation works, another trouble happens, the subpages content is not load, but the subpages itself do. For the other hand, the dashboard page works and is translated without troubles…
–
So this was my third step, in the ‘render_page()’ function there is the line:
$screen = get_current_screen()->id;The variable $screen should be ‘toplevel_page_itsec’ or ‘security_page_toplevel_page_itsec_settings’, but when the translation works, the subtring ‘security’ is translated too to another language and the content conditional return false.
So, after the $creen variable is declared I added this 3 lines:
$pre_screen = substr( $screen, 0, strpos( $screen, ‘_’ ) );
if( ‘toplevel’ !== $pre_screen )
$screen = ‘security’ . substr( $screen, strpos( $screen, ‘_’ ) );–
And that’s all. All works perfectly.
My last step was to translate the plugin to spanish.
–
I hope the iThemes Team reads this. I have the modified and the translation files saved and I want to give them. No doubt to contact me.
Have a nice day!
The topic ‘Solved the translation issue’ is closed to new replies.