In my ZF2 application I want to retrieve the language that was used to translate the page. I use the ZendSkeletonApplication as basis. In the Module.php I set the Locale like this:
public function onBootstrap($e){
$translator = $e->getApplication()->getServiceManager()->get('translator');
$translator->setLocale(
Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE'])
)
->setFallbackLocale('en_US');
}
I can retrieve the locale and the fallbackLocale from the Zend\I18n\Translator\Translator, but then I still don't know which one was used for the translation. Since there is also no way (as far as I didn't found one) to find out which languages where actually loaded into the translator. I can't even test myself if a translation exists for the locale.
Maybe I'm missing something here. I hope someone can point that out.