Network-Manager-Tools
Network-Manager-Tools copied to clipboard
Help with i18n?
Hey @earnjam,
I'm looking for ways to help further with this plugin, and I notice that you are using some i18n stuff, but not every field that needs translating is enclosed in a __()
function. Most notably, the large chunks of text in the class-nmt-site-info.php
file in the includes
folder.
Also, the ones that are don't seem to have a text domain included. (though the class-nmt-i18n.php
file does create a text domain.)
Perhaps its just me trying to understand, but I've read that all translatable text should have a text domain included in the call as the second parameter, like this: __( 'Subscribe', 'network-manager-tools' )
I'm willing to help change all the calls to something like that, but didn't want to start doing it if there is a reason why it's not being done.
Is it not necessary when the plugin class is already being declared, or something?
No, I just haven't gotten around to do it because I was focusing on other things :)
You are welcome to start adding those things if you want. I originally started with the WP Plugin Boilerplate and it included the i18n stuff. I thought it would be a good idea to have that in there, but figured I'd circle back around to making sure all was good later. On Mon Jan 26 2015 at 9:27:07 AM Ben Meredith [email protected] wrote:
Hey @earnjam https://github.com/earnjam,
I'm looking for ways to help further with this plugin, and I notice that you are using some i18n stuff, but not every field that needs translating is enclosed in a __() function. Most notably, the large chunks of text in the class-nmt-site-info.php file in the includes folder.
Also, the ones that are don't seem to have a text domain included. (though the class-nmt-i18n.php file does create a text domain.)
Perhaps its just me trying to understand, but I've read that all translatable text should have a text domain included in the call as the second parameter, like this: __( 'Subscribe', 'network-manager-tools' )
I'm willing to help change all the calls to something like that, but didn't want to start doing it if there is a reason why it's not being done.
Is it not necessary when the plugin class is already being declared, or something?
— Reply to this email directly or view it on GitHub https://github.com/earnjam/Network-Manager-Tools/issues/7.
So, on line 50 of class-nmt-plugin-manager.php, it adds the submenu tab that reads "Plugins" on the "Edit Site:" pages.
But where is that actual tab text being added? I have found a way to translate the "Plugins" text that shows up when you are actually on that page (line 375 in the same file), but when I'm on any of the other tabs (Info, Users, Themes, Settings), the text in the "Plugins" menu item is not being translated.
Aha! It's in a js file. Which means I don't know how to translate it yet.
Yeah, unfortunately that is the only way to add those tabs at the moment because they are hardcoded on each page On Wed, Feb 11, 2015 at 11:19 AM Ben Meredith [email protected] wrote:
Aha! It's in a js file. Which means I don't know how to translate it yet.
— Reply to this email directly or view it on GitHub https://github.com/earnjam/Network-Manager-Tools/issues/7#issuecomment-73910016 .
wp_localize_script
is your friend when needing to pass translated text to Javascript.