I built an application that uses ZF2 for authentification, routing, error pages etc., but the core functionalities on each view are implemented in AngularJS. The whole thing is localized, but in 2 seperate instances:
We have the ZF2 Translator, configured in module.config.php
'translator' => array(
'locale' => 'de_DE',
'translation_file_patterns' => array(
array(
'type' => 'phparray',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.php',
),
),
),
containing key=>value pairs like 'app.frontend.title' => 'Title'
.
And the Angular-Translate module, configured by
$translateProvider.useStaticFilesLoader({
prefix: '/lang/',
suffix: '.json'
});
containing a nested JSON object like {'app': {'buttons': {'send': 'Send now'}}}'
The PHP part contains some headlines, content for <title>
, navigation,... pretty much everything that is displayed outside of my AngularJS apps. The Angular-JSON contains l10n for a lot of buttons, dialogs etc.
Is there a possibility to unify these two? Doesn't matter if I access the AngularJS json file from the php script or the other way round (get the .json dynamically served by PHP for Angular). But I can't figure out how to read JSON for the ZF2 Translator.