1

I wish to localize some text in my child theme.

I followed the instructions here:

https://codex.wordpress.org/Child_Themes#Internationalization

However, I just created empty po files (eg: he.po) and placed them in the languages directory. When I load my wordpress site (which has a line like __('some text', 'some-child-theme'); in the functions.php file), the po file stays empty (ie: "some text" is not added to it).

What do I need to do in order to have the text in my code added to my languages/he.po file?

I downloaded POedit on my development computer. Do I need to download it on the server that is running my wordpress site as well? And then is there some command where it scrapes my php code for all the translatable strings and generates the po file?

Or, am I just supposed to write the po file by hand?

Thanks.

  • look at the google results google.co.il/…. seems like the codex is useless but there is alot of documentation of the process. And ithis all depends on if your theme is translatable at all – Mark Kaplun Sep 11 '16 at 19:16
  • it's Poedit which read the PHP code to make the PO file – mmm Sep 11 '16 at 19:36
  • @mmm So should I download Poedit on my server? How come the instructions that I referenced in my question don't mention this at all? – theyuv Sep 12 '16 at 12:40
  • @MarkKaplun Thanks, the whole idea is that I'm trying to make my theme translatable. If I follow the instructions in the link I referenced then I should be able to make my theme translatable, no? (Except for the fact that I can't seem to automatically populate the po files). – theyuv Sep 12 '16 at 12:42
  • making a theme translatable has noting to do with po files. right now the question is too confusing to me please edit it and explain better what is it that you actually want to do – Mark Kaplun Sep 12 '16 at 12:59
1

You can use POedit to generate the PO file from source code:

https://codex.wordpress.org/User:Skippy/Creating_POT_Files

The problem for me is that my WordPress installation is running on an Amazon Linux server, which does not have a package in the repos for POedit and I couldn't figure out how to install POedit on my server (only on my local Windows machine). If anyone can point me to instructions on how to install POedit on an Amazon Linux Server or how to generate the PO file another way from source code on my server I would appreciate it.

As a hack, since I don't have that many files in my theme, I simply moved the necessary php files to my local (Windows) machine (which has POedit installed) and generated the PO file from the source code on my local machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.