admin管理员组

文章数量:1122832

I'm creating a new plugin actually, the plugin is working perfectly, but it's not available yet in the wordpress website, I have an issue with the translation, I will not use wordpress for the translation, it's a local translation, so I generated the PO and MO files using POedit, and I followed all the steps here : / from writing a perfect header in the main plugin file till adding php code in the same file in order to load text domain and the MO file, When I change the wordpress language from English to French, the plugin still with EN language,

What can be the issue ? is it because the plugin is not on the wordpress yet ?

Here's my laptop config :

  • locahost : wampserver
  • Windows 10
  • Php version : 8.1

Thanks !!

I'm creating a new plugin actually, the plugin is working perfectly, but it's not available yet in the wordpress.org website, I have an issue with the translation, I will not use wordpress.org for the translation, it's a local translation, so I generated the PO and MO files using POedit, and I followed all the steps here : https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/ from writing a perfect header in the main plugin file till adding php code in the same file in order to load text domain and the MO file, When I change the wordpress language from English to French, the plugin still with EN language,

What can be the issue ? is it because the plugin is not on the wordpress.org yet ?

Here's my laptop config :

  • locahost : wampserver
  • Windows 10
  • Php version : 8.1

Thanks !!

Share Improve this question edited May 28, 2024 at 17:57 Sam94 asked May 27, 2024 at 14:34 Sam94Sam94 151 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Here's the solution : I'm talking about my case here, When I added the Text Domain Name to Gettext functions in interface.php file, I used this command line : php add-textdomain.php TextDomainNameOfThePlugin PathToInterfaceFile/interface.php > tdn.php , So I generated tdn.php as you can see in that command line, and constructed my POT, PO and MO files based on this UNUSED NEW FILE, and I forgot to either rename tdn.php to interface.php (and delete the old interface.php) so I can use it, or to copy its content and paste in into interface.php file that didn't contain Text Domain Name in its Gettext functions.

So now, I just copied tdn.php content to interface.php, and the translation works perfectly.

本文标签: WordPress Plugin translation not working EN To FR