3

I have a multi-locale application where I would like to present the translations POT files, generated by xgettext, to a translator for each locale.

I can currently do this with the following code (note that this is just sample code, not the actual country specific requirements):

<?php
gettext('Address 1');

if($CountryHasAddress2){
    dgettext('germany', 'Address 2');
    dgettext('spain', 'Address 2');
    dgettext('france', 'Address 2');
}

if($CountryHasAddress3){
    dgettext('spain', 'Address 3');
}  

I would like to be able to do the following:

<?php
gettext('Address 1');

$CountryHasAddress2 = array('germany', 'spain', 'france');
dgettext($CountryHasAddress2, 'Address 2');

$CountryHasAddress3 = array('spain');
dgettext($CountryHasAddress3, 'Address 3');

And generate the POT file for each country.

xgettext -d germany --output=germany.po
xgettext -d spain --output=spain.po
xgettext -d france --output=france.po

Questions:

Is there a method of gettext to handle the array of 'domains', or will I need to extend the gettext library?

Does 'Address 1' get included in the POT file when I specify the domain(-d) flag for xgettext, or do I need another flag to include gettext and dgettext wrapped strings?

lexum
  • 31
  • 1

0 Answers0