The short answer is, you cannot.
POEdit uses xgettext to scan your files using special syntax, ignoring commented lines.
For example, if your keywords are _
, the following examples will be analyzed as follows:
_('test');
โ string 'test'
_("test");
โ string 'test'
_('test'
โ string 'test'
_ 'test
โ no catch
_('test
โ no catch
_(test)
โ no catch
_($test)
โ no catch
//_('test');
โ no catch
/*_('test');*/
โ no catch
You can execute xgettext
with other parameters, but I'm not sure if you can achieve your goal.
One simple fix (not standard) is to add another keyword, such as placeholder
, and make a php function like
function placeholder($string){}
and use it so that POEdit can analyze it
class MyController extends Controller { public function index() { placeholder('Home'); ... } }
In your frontend syntax just use simple _($value)
and you translate your header.
I donโt know how your code is, but suppose something similar to this.
Assuming $ tag = 'title' and $ value = 'Home'
echo '<'.$tag.'>'._($value).'</'.$tag.'>';