![]() ![]() Language changed everywhere else but the plugin still renders in english. Changed Wordpress site language to translated language.Renamed files to my-plugin-pt.po and my-plugin-pt.mo.pot file in Poedit, (it displayed a list of all the strings I wanted to translate) translated plugin and generated. Used Loco Translate plugin to generate a.Added either _e() or _() to the sentences I want to be translated in my plugin files.I'm not sure what else to try so I thought that someone more experienced could point out things I might need to change. Free Download for Windows 7+ v3.3 What’s new Windows download for Windows 7+ Mac download for macOS 10.13+ Linux download snap package Source code: poedit-3.3.tar. Poedit is a tool that you can use to translate WordPress themes and plugins. Get Poedit desktop app Experience the convenience of improved translation workflow. In this article, we’ll show you how to use Poedit to translate a WordPress plugin. It’s available for Windows, macOS, and Linux. It uses the WordPress translation code to do some of the work.I am trying to add a translation to a plugin I wrote from scratch but after experimenting a while I'm not sure how to make Wordpress aware that there's a translation available for my plugin. Poedit is a free, open source program that helps you manage and translate software projects. So you need the whole checkout, not just the tools directory. Note that the makepot.php code is not standalone, it requires that WordPress's source code be available. If you used any special translation methods like _x or _ex or _n_noop, then those will be in the file as well. Note that the headers of the plugin are included in the POT file too. You may want to edit its header (in any text editor) to have your author and plugin info in it and such.Ĭompare the results yourself. The PHP code will scan your plugin's directory and build a POT file for you.Ī POT file is a "PO Template", which poedit can handle quite nicely, I believe. Replace the path to your plugin's folder with the relevant local copy of the plugin, and use your own plugin's slug for the pot file name. You can also use wp-theme here to generate a POT file for a theme. The "wp-plugin" flag is telling the code to examine a plugin. Php makepot.php wp-plugin /path/to/your/plugin/folder plugin-slug.pot Here you will find a file called makepot.php. Go into that directory, then in the tools directory, then in the i18n directory. (Note: If you are a git user, you can make a clone of git:/// instead.) You may not need all of these tools, but there is one that you do need. This will get you a copy of the WordPress trunk directory, and the special tools developers need with it. This has the advantages of a) not needing you to do anything special in poedit and b) getting everything that is possible for translation, including headers and non-standard translation string calls (not everything is _ and _e). ![]() Instead of using poedit to generate your translation strings from your code, use the WordPress i18n tools to generate a POT file for you. So my guess is I'm doing something wrong in my WP files. But if I put this on my website and change WordPress it's language it doesn't change anything. po file, it does show me strings in POedit. Is anyone seeing where it's going wrong here? I tell poedit to look for the keywords _() and _e().Īnd then I press ok! Every single time (whatever I seem to try) It doesn't show me any strings to translate, where as I import a normal. admin or admin (if I give it /admin, or something else, it gives me an error the folder doesn't exist. I tell poedit to save the myplugin-nl_NL.po in the languages folder in my plugin.Īnd I tell my paths to be either. Then I adjust all strings that need translation in my file (which is in the admin folder). ![]() Load_plugin_textdomain( 'myplugin', false, dirname( plugin_basename( _FILE_ ) ). So in myplugin.php I load the following to tell WP where my language files are (after actually creating the folder). So let's do this step by step as multiple tutorials show me to. I don't know what is going wrong, but it's bugging out on me when I try to load it in Poedit. I want to start making it localization ready. I'm building a plug-in which is going great so far. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |