Modify the following files on your Symfony project to enable this bundle:
- in app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles(){
$bundles = array(
new StrSocial\Bundle\LocalizationBundle\StrSocialLocalizationBundle(),
);
}
}
- app/config/routing.yml
str_social_localization_bundle:
resource: "@StrSocialLocalizationBundle/Controller/"
type: annotation
prefix: /
- add l10n js scripts to your twig
{% javascripts
'@StrSocialLocalizationBundle/Resources/public/js/vendor/*'
'@StrSocialLocalizationBundle/Resources/public/js/*'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
- to easily activate the feature from the frontend, add this to your js script
$(document).ready(function(){
StrSocialL10n.fn.postTimeZoneAndReloadPageIfNeeded();
});