1

I spent several hours searching, and have not found a solution, how to extract Strings dedicated by Textdomain from a PHP File (in a wordpress plugin):

In my plugin and theme I use for example

__('This should be internationalized Module A','MyTextdomain-A');
__('This should be internationalized Module B','MyTextdomain-B');

I have no problem extracting this via PoEdit (which seems to be the standard). It will all endup in one(!!) .pot file. But this is not what i want.

I want the "Extractor" only to extract all Strings from Textdomain A or Textdomain B individually, but not both together.

How can I solve this. This seems to be an absolutely trival requirement, but I have not found a solution yet.

UPDATE: Why is this so important? Because in a standard Application you have for example lots of Backend Text. This is unnecessary to be loaded in Frontend-Calls ans saves a lot of RAM. Separating is key here. And even in single files you might want to split messages in a "BASE" and "CUSTOM" file (one that is shared the otherone changable by users etc). Whithout extracting by Textdomain individually, this is not possible to do efficiently.

Thanks very much

  • 1
    There is a discussion on woocommerces' github about splitting language files with reference to a WP file called makepot.php that will split them. Maybe this code will direct you? github.com/woothemes/woocommerce/issues/2051 – Digitalchild May 21 '15 at 23:35
  • Thanks very much! Heard of makepots.php but didn't investigate it then. Thanks to your hint I looked at the source now. I am not shure (its not documented at all) it allows parsing the context but looks like it is not used for the context I want. But then "hacking" the code should be possible. Thanks, you can post it as answer, I will tick it as accepted. – Tim Schmidt May 22 '15 at 20:23
  • Ok, i'll make the comment a post. – Digitalchild May 23 '15 at 8:36
0

There is a discussion on woocommerces' github about splitting language files with reference to a WP file called makepot.php that will split them. Maybe this code will direct you? github.com/woothemes/woocommerce/issues/2051

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.