Php source code for PO file generator

I need to convert the whole line echo / print from the code file php source in the file PO (for language translation ), is there any batch convector for him.

+2


source to share


4 answers


Yes, I got the answer.

There is a way to extract the entire line from the source file for a folder. Here is a link you can check:



  • Extract lines from source for translation (for po file) [link now dead]

  • Poedit: cross platform PO to MO converter and PO file editor [link is dead now]

-1


source


How I do it:



  • run gettext on your server
  • set up a translation adapter (e.g. Zend_Translate using gettext adapter)
  • use a good search tool to find all lines in your code and wrap with something like $ translationObject-> translate (). Often the method is wrapped called __ (). This will be at least partially handwork in most cases, as you will have various string shapes that you might want to break down into shorter units as well.
  • install poEdit and configure it to parse for 'translate (' or '__ ('
  • send the resulting resulting files to human translators and tell them how to use poEdit
  • download translations and create mo files which are used by adapter
+3


source


Unfortunately, I don't think such a tool exists. If you find it, it will probably be limited in functionality

It has to do with php's interoperability with html. It is difficult to know what exactly should be included in a particular gettext file.

If you only use "echo" instructions to send content to the browser, and you never mix html and php, then it's pretty easy to write a script to parse that.

NTN, -Ft

0


source


You need http://www.poedit.net/

You can use Poedit to scan source code for translatable strings.

0


source







All Articles