Hello @salvatorenoschese ,
I think you are using this way !
_e( 'Administration Email Address' );
_e( 'Anyone can register' );
So when you use the same string in your plugin without a text domain, Poedit will treat it as belonging to your plugin and might add it to your translation file.
To avoid this and to ensure that the string is recognized as part of WordPress core translations, you should specify the 'default' text domain when using core strings in your plugin like this
_e( 'Anyone can register', 'default' );
Poedit isn’t sophisticated enough to distinguish from different text domains in plugin files. Expected behavior, though I wouldn’t say it’s “correct” behavior 🙂 The textdomain property is principally used for organizational purposes and to allow WP to load the correct translation files. Since core translations are always loaded, it doesn’t really matter which you specify, but for consistency I recommend specifying anyway.
Consider carefully which core translations you use. It’s possible a core string could change in the future, requiring you to update your code accordingly. Some strings are less likely to change than others. I’d stick with the unlikely to change strings.
ty for reply. I used just some classic strings like delete, apply, and similar.
atm I just need to maintain this without see in Poedit. Yep, I can manually remove, but if exist a simplest way to import only string with my custom-textdomain, can be best.
@kallyansin , Sorry, seen only not your message.
in realty I tried both without any text-domain, and with default. But are still present in po files when I run “import from source”.
Hey @salvatorenoschese ,
That is the default behaviour when Poedit scans for all the translateable strings in the WordPress Codebase which includes both core and your custom plugin code.
Here is my suggestion to import only your plugin’s string into Poedit.
1. Use a Unique Text Domain: __('Hello World', 'custom-plugin');
2. Modify the Source Code Settings: Open your project, Go to Catalog > Properties > Sources , here specify your plugin path. for example wp-content/plugins/test-plugin/, Replace test-plugin with your plugin name.
3. In the same dialog box exclude wp-includes/ wp-core/ but again if you specify the exact plugin path as mentioned in step 2 this step can be skipped.
4. Run import again and see if it works.
Please try above mentioned solution. Let me know if you need any further help.