Using gettext
Single value
echo gettext( \"Hello, world!\\n\" );
Plurals
printf(ngett
For the ones using Poedit like me you need to following. First create the function. I'm using one named _x like the one WordPress use:
if (!function_exists('_x')) {
function _x($string, $context)
{
$contextString = "{$context}\004{$string}";
$translation = _($contextString);
if ($translation == $contextString)
return $string;
return $translation;
}
}
Then on poedit you need to enter the following on Sources Keywords tab:
_x:1,2c
_
So when you need to use context translation you use _x function. Eg:
I took all the info from these links: