diff --git a/app/AppKernel.php b/app/AppKernel.php
index ad2d8ac..baa1be6 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -17,6 +17,8 @@ public function registerBundles()
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
+ new JMS\DiExtraBundle\JMSDiExtraBundle($this),
+ new JMS\AopBundle\JMSAopBundle(),
new JMS\I18nRoutingBundle\JMSI18nRoutingBundle(),
new JMS\TranslationBundle\JMSTranslationBundle(),
new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(),
diff --git a/app/Resources/JMSTranslationBundle/views/Translate/index.html.twig b/app/Resources/JMSTranslationBundle/views/Translate/index.html.twig
new file mode 100644
index 0000000..5bc13d0
--- /dev/null
+++ b/app/Resources/JMSTranslationBundle/views/Translate/index.html.twig
@@ -0,0 +1,130 @@
+{% extends "SumoCodersFrameworkCoreBundle::base.html.twig" %}
+
+{% block header_title %}
+
+ {{ 'navigation.translations'|trans|capitalize }}
+
+{% endblock %}
+
+{% block javascripts %}
+ {{ parent() }}
+
+
+{% endblock %}
+
+{% block main %}
+
+
+
+ {% if isWriteable is sameas(false) %}
+
+ The translation file "{{ file }} " is not writable.
+
+ {% endif %}
+
+ {% if "xliff" != format %}
+
+ Due to limitations of the different loaders/dumpers, some features are unfortunately limited to the XLIFF format.
+
+
+
+ However, you can easily convert your existing translation files to the XLIFF format by running:
+ php app/console translation:extract {{ selectedLocale }} --config={{ selectedConfig }} --output-format=xliff
+
+ {% endif %}
+
+
+
+
Available Messages
+
+
+
+ {% if newMessages is not empty %}
+
+
+
New Messages
+ {% include "JMSTranslationBundle:Translate:messages.html.twig" with {"messages": newMessages} %}
+
+
+ {% endif %}
+
+ {% if existingMessages is not empty %}
+ Existing Messages
+ {% include "JMSTranslationBundle:Translate:messages.html.twig" with {"messages": existingMessages} %}
+ {% endif %}
+
+{% endblock %}
diff --git a/app/Resources/JMSTranslationBundle/views/Translate/messages.html.twig b/app/Resources/JMSTranslationBundle/views/Translate/messages.html.twig
new file mode 100644
index 0000000..978af4e
--- /dev/null
+++ b/app/Resources/JMSTranslationBundle/views/Translate/messages.html.twig
@@ -0,0 +1,60 @@
+
+
+
ID
+
+
+
Translation
+
+
+
Additional Information
+
+
+
+
+ {% for id, message in messages %}
+
+
+
+
+
{{ id|truncate(20) }}
+
+
+
+
+
+ {% if message.meaning is not empty %}
+
Meaning
+
{{ message.meaning }}
+ {% endif %}
+
+ {% if alternativeMessages[id] is defined %}
+
Alternative Translations
+ {% for locale, altMessage in alternativeMessages[id] %}
+
+ {{ locale }}:
{{ altMessage.localeString }}
+
+ {% endfor %}
+ {% endif %}
+
+ {% if message.sources|length > 0 %}
+
Sources
+
+ {% for source in message.sources %}
+ {{ source }}
+ {% endfor %}
+
+ {% endif %}
+
+ {% if message.desc is not empty
+ and message.localeString != message.desc
+ and id != message.desc
+ and (alternativeMessages[id][sourceLanguage] is not defined
+ or alternativeMessages[id][sourceLanguage].localeString != message.desc) %}
+
Description
+
{{ message.desc }}
+ {% endif %}
+
+
+ {% endfor %}
+
+
diff --git a/app/Resources/translations/messages.en.xliff b/app/Resources/translations/messages.en.xliff
new file mode 100644
index 0000000..2f69d44
--- /dev/null
+++ b/app/Resources/translations/messages.en.xliff
@@ -0,0 +1,76 @@
+
+
+
+
+
+ The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.
+
+
+
+ Controller/Tests/DatePickerController.php
+ Ok
+ Ok
+
+
+ Resources/views/base.html.twig
+ core.interface.backToTop
+ core.interface.backToTop
+
+
+ Resources/views/base.html.twig
+ Resources/views/empty.html.twig
+ core.warnings.oldBrowser
+ core.warnings.oldBrowser
+
+
+ views/Form/fields.html.twig
+ datepicker.pickDate
+ datepicker.pickDate
+
+
+ Resources/views/dialogs.html.twig
+ dialogs.buttons.cancel
+ dialogs.buttons.cancel
+
+
+ Resources/views/dialogs.html.twig
+ dialogs.buttons.ok
+ dialogs.buttons.ok
+
+
+ Resources/views/base.html.twig
+ Resources/views/empty.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ dialogs.close
+ dialogs.close
+
+
+ Resources/views/base.html.twig
+ search.forms.buttons.search
+ search.forms.buttons.search
+
+
+ Resources/views/base.html.twig
+ search.forms.placeholders.term
+ search.forms.placeholders.term
+
+
+ Resources/views/base.html.twig
+ user.header.actions.logout
+ user.header.actions.logout
+
+
+ Resources/views/base.html.twig
+ user.header.actions.settings
+ user.header.actions.settings
+
+
+
+
diff --git a/app/Resources/translations/messages.fr.xliff b/app/Resources/translations/messages.fr.xliff
new file mode 100644
index 0000000..c406b6d
--- /dev/null
+++ b/app/Resources/translations/messages.fr.xliff
@@ -0,0 +1,76 @@
+
+
+
+
+
+ The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.
+
+
+
+ Controller/Tests/DatePickerController.php
+ Ok
+ Ok
+
+
+ Resources/views/base.html.twig
+ core.interface.backToTop
+ core.interface.backToTop
+
+
+ Resources/views/base.html.twig
+ Resources/views/empty.html.twig
+ core.warnings.oldBrowser
+ core.warnings.oldBrowser
+
+
+ views/Form/fields.html.twig
+ datepicker.pickDate
+ datepicker.pickDate
+
+
+ Resources/views/dialogs.html.twig
+ dialogs.buttons.cancel
+ dialogs.buttons.cancel
+
+
+ Resources/views/dialogs.html.twig
+ dialogs.buttons.ok
+ dialogs.buttons.ok
+
+
+ Resources/views/base.html.twig
+ Resources/views/empty.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ dialogs.close
+ dialogs.close
+
+
+ Resources/views/base.html.twig
+ search.forms.buttons.search
+ search.forms.buttons.search
+
+
+ Resources/views/base.html.twig
+ search.forms.placeholders.term
+ search.forms.placeholders.term
+
+
+ Resources/views/base.html.twig
+ user.header.actions.logout
+ user.header.actions.logout
+
+
+ Resources/views/base.html.twig
+ user.header.actions.settings
+ user.header.actions.settings
+
+
+
+
diff --git a/app/Resources/translations/messages.nl.xliff b/app/Resources/translations/messages.nl.xliff
new file mode 100644
index 0000000..28f2afa
--- /dev/null
+++ b/app/Resources/translations/messages.nl.xliff
@@ -0,0 +1,76 @@
+
+
+
+
+
+ The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.
+
+
+
+ Controller/Tests/DatePickerController.php
+ Ok
+ Ok
+
+
+ Resources/views/base.html.twig
+ core.interface.backToTop
+ core.interface.backToTop
+
+
+ Resources/views/base.html.twig
+ Resources/views/empty.html.twig
+ core.warnings.oldBrowser
+ core.warnings.oldBrowser
+
+
+ views/Form/fields.html.twig
+ datepicker.pickDate
+ datepicker.pickDate
+
+
+ Resources/views/dialogs.html.twig
+ dialogs.buttons.cancel
+ dialogs.buttons.cancel
+
+
+ Resources/views/dialogs.html.twig
+ dialogs.buttons.ok
+ dialogs.buttons.ok
+
+
+ Resources/views/base.html.twig
+ Resources/views/empty.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ Resources/views/notifications.html.twig
+ dialogs.close
+ dialogs.close
+
+
+ Resources/views/base.html.twig
+ search.forms.buttons.search
+ search.forms.buttons.search
+
+
+ Resources/views/base.html.twig
+ search.forms.placeholders.term
+ search.forms.placeholders.term
+
+
+ Resources/views/base.html.twig
+ user.header.actions.logout
+ user.header.actions.logout
+
+
+ Resources/views/base.html.twig
+ user.header.actions.settings
+ user.header.actions.settings
+
+
+
+
diff --git a/app/config/config.yml b/app/config/config.yml
index 1e23154..f4ab39b 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -7,6 +7,11 @@ services:
fos_user.doctrine_registry:
alias: doctrine
+ twig.extension.text:
+ class: Twig_Extensions_Extension_Text
+ tags:
+ - { name: twig.extension }
+
# Framework configuration
framework:
translator: { fallback: "%locale%" }
@@ -111,3 +116,14 @@ swiftmailer:
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
+
+# Translation configuration
+jms_translation:
+ configs:
+ app:
+ dirs: [%kernel.root_dir%, %kernel.root_dir%/../src]
+ output_dir: %kernel.root_dir%/Resources/translations
+ ignored_domains: [routes]
+ excluded_names: ["*TestCase.php", "*Test.php", "DefaultMenuListener.php"]
+ excluded_dirs: [cache, data, logs]
+ extractors: [jms_i18n_routing]
diff --git a/app/config/routing_dev.yml b/app/config/routing_dev.yml
index 67fb6f6..be7b907 100644
--- a/app/config/routing_dev.yml
+++ b/app/config/routing_dev.yml
@@ -17,3 +17,8 @@ _main:
sumo_coders_example_bundle:
resource: "@SumoCodersFrameworkExampleBundle/Resources/config/routing.yml"
prefix: /example
+
+JMSTranslationBundle_ui:
+ resource: @JMSTranslationBundle/Controller/
+ type: annotation
+ prefix: /_trans
diff --git a/composer.json b/composer.json
index d6cdb55..19f5289 100644
--- a/composer.json
+++ b/composer.json
@@ -36,6 +36,7 @@
"jms/translation-bundle": "^1.1",
"knplabs/knp-menu-bundle": "^2.1",
"tijsverkoyen/css-to-inline-styles": "^2.0",
+ "jms/di-extra-bundle": "^1.7",
"sumocoders/framework-error-bundle": "^3.0",
"sumocoders/framework-user-bundle": "^3.0",
diff --git a/composer.lock b/composer.lock
index 4fd5dca..d396b38 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "db29e00614ded6157b51227da96b1467",
- "content-hash": "19647745fea04e590e1bd7b2f63fcf7a",
+ "hash": "35130a8c9dc716543dfb8a258b02f5ba",
+ "content-hash": "6940c7b001ee137df87881220f55e33a",
"packages": [
{
"name": "dbtlr/php-airbrake",
@@ -1004,12 +1004,12 @@
"source": {
"type": "git",
"url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git",
- "reference": "88f84f631ee7859c069cf98b475c679e90b16b22"
+ "reference": "d1fccc6335b74beca94525551cacc06b256ed261"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/16b04c49af05dd3fb381e4abe04f0e5e231ac76d",
- "reference": "88f84f631ee7859c069cf98b475c679e90b16b22",
+ "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/d1fccc6335b74beca94525551cacc06b256ed261",
+ "reference": "d1fccc6335b74beca94525551cacc06b256ed261",
"shasum": ""
},
"require": {
@@ -1065,7 +1065,7 @@
"keywords": [
"User management"
],
- "time": "2016-03-04 13:20:42"
+ "time": "2016-05-27 12:14:43"
},
{
"name": "incenteev/composer-parameter-handler",
@@ -1210,6 +1210,169 @@
],
"time": "2014-01-12 16:20:24"
},
+ {
+ "name": "jms/aop-bundle",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/schmittjoh/JMSAopBundle.git",
+ "reference": "78000d007e74283cc564a58e184d7f62548ad394"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/schmittjoh/JMSAopBundle/zipball/78000d007e74283cc564a58e184d7f62548ad394",
+ "reference": "78000d007e74283cc564a58e184d7f62548ad394",
+ "shasum": ""
+ },
+ "require": {
+ "jms/cg": "^1.1",
+ "php": ">=5.3.9",
+ "symfony/framework-bundle": "^2.3|^3.0"
+ },
+ "require-dev": {
+ "symfony/phpunit-bridge": "^2.7"
+ },
+ "type": "symfony-bundle",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "JMS\\AopBundle\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Johannes M. Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Adds AOP capabilities to Symfony2",
+ "keywords": [
+ "annotations",
+ "aop"
+ ],
+ "time": "2015-12-09 16:30:46"
+ },
+ {
+ "name": "jms/cg",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/schmittjoh/cg-library.git",
+ "reference": "0af1113c7409b8636c5244bbae10b2e0ff792e9c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/schmittjoh/cg-library/zipball/0af1113c7409b8636c5244bbae10b2e0ff792e9c",
+ "reference": "0af1113c7409b8636c5244bbae10b2e0ff792e9c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "CG\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache2"
+ ],
+ "authors": [
+ {
+ "name": "Johannes M. Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Toolset for generating PHP code",
+ "keywords": [
+ "code generation"
+ ],
+ "time": "2015-09-13 08:54:43"
+ },
+ {
+ "name": "jms/di-extra-bundle",
+ "version": "1.7.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/schmittjoh/JMSDiExtraBundle.git",
+ "reference": "27c3fc7150550ccc0731290b2c1ceb57449f909d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/schmittjoh/JMSDiExtraBundle/zipball/27c3fc7150550ccc0731290b2c1ceb57449f909d",
+ "reference": "27c3fc7150550ccc0731290b2c1ceb57449f909d",
+ "shasum": ""
+ },
+ "require": {
+ "jms/aop-bundle": "~1.1",
+ "jms/metadata": "~1.0",
+ "php": "~5.3|~7.0",
+ "symfony/dependency-injection": "~2.3|~3.0",
+ "symfony/finder": "~2.3|~3.0",
+ "symfony/framework-bundle": "~2.3|~3.0",
+ "symfony/http-kernel": "^2.3.24|~3.0",
+ "symfony/process": "~2.3|~3.0",
+ "symfony/routing": "~2.3|~3.0"
+ },
+ "require-dev": {
+ "doctrine/doctrine-bundle": "~1.5",
+ "doctrine/orm": "~2.3",
+ "jms/security-extra-bundle": "~1.0",
+ "phpcollection/phpcollection": ">=0.2,<0.3-dev",
+ "sensio/framework-extra-bundle": "~2.0|~3.0",
+ "symfony/browser-kit": "~2.3|~3.0",
+ "symfony/class-loader": "~2.3|~3.0",
+ "symfony/form": "~2.3|~3.0",
+ "symfony/phpunit-bridge": "~2.7",
+ "symfony/security-bundle": "~2.3",
+ "symfony/twig-bundle": "~2.3|~3.0",
+ "symfony/validator": "~2.3|~3.0",
+ "symfony/yaml": "~2.3|~3.0"
+ },
+ "type": "symfony-bundle",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "JMS\\DiExtraBundle\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Johannes M. Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Allows to configure dependency injection using annotations",
+ "homepage": "http://jmsyst.com/bundles/JMSDiExtraBundle",
+ "keywords": [
+ "annotations",
+ "dependency injection"
+ ],
+ "time": "2016-04-18 22:27:09"
+ },
{
"name": "jms/i18n-routing-bundle",
"version": "2.0.0",
@@ -1266,6 +1429,58 @@
],
"time": "2015-12-01 23:14:47"
},
+ {
+ "name": "jms/metadata",
+ "version": "1.5.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/schmittjoh/metadata.git",
+ "reference": "22b72455559a25777cfd28c4ffda81ff7639f353"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/22b72455559a25777cfd28c4ffda81ff7639f353",
+ "reference": "22b72455559a25777cfd28c4ffda81ff7639f353",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "doctrine/cache": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.5.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Metadata\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache"
+ ],
+ "authors": [
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com",
+ "homepage": "https://github.com/schmittjoh",
+ "role": "Developer of wrapped JMSSerializerBundle"
+ }
+ ],
+ "description": "Class/method/property metadata management in PHP",
+ "keywords": [
+ "annotations",
+ "metadata",
+ "xml",
+ "yaml"
+ ],
+ "time": "2014-07-12 07:13:19"
+ },
{
"name": "jms/translation-bundle",
"version": "1.1.0",
diff --git a/src/SumoCoders/FrameworkCoreBundle/EventListener/MenuListener.php b/src/SumoCoders/FrameworkCoreBundle/EventListener/MenuListener.php
new file mode 100644
index 0000000..df3e841
--- /dev/null
+++ b/src/SumoCoders/FrameworkCoreBundle/EventListener/MenuListener.php
@@ -0,0 +1,30 @@
+getMenu();
+
+ if ($this->getSecurityAuthorizationChecker()->isGranted('ROLE_ADMIN')) {
+ $menuItem = $event->getFactory()->createItem(
+ 'navigation.translations',
+ array(
+ 'route' => 'jms_translation_index',
+ )
+ );
+ $menuItem->setLinkAttributes(
+ array(
+ 'class' => 'menu-item',
+ )
+ );
+
+ $menu->addChild($menuItem);
+ }
+ }
+}
diff --git a/src/SumoCoders/FrameworkCoreBundle/Resources/config/services.yml b/src/SumoCoders/FrameworkCoreBundle/Resources/config/services.yml
index 7612933..67389b2 100644
--- a/src/SumoCoders/FrameworkCoreBundle/Resources/config/services.yml
+++ b/src/SumoCoders/FrameworkCoreBundle/Resources/config/services.yml
@@ -67,3 +67,10 @@ services:
- [setDefaultReplyTo, ["%mailer_default_reply_to_email%", "%mailer_default_reply_to_name%"]]
- [setDefaultTo, ["%mailer_default_to_email%", "%mailer_default_to_name%"]]
+ framework.menu_listener:
+ class: SumoCoders\FrameworkCoreBundle\EventListener\MenuListener
+ arguments:
+ - @security.authorization_checker
+ - @security.token_storage
+ tags:
+ - { name: kernel.event_listener, event: framework_core.configure_menu, method: onConfigureMenu }
diff --git a/src/SumoCoders/FrameworkCoreBundle/Resources/translations/messages.en.yml b/src/SumoCoders/FrameworkCoreBundle/Resources/translations/messages.en.yml
index 2b8c300..f0b8435 100644
--- a/src/SumoCoders/FrameworkCoreBundle/Resources/translations/messages.en.yml
+++ b/src/SumoCoders/FrameworkCoreBundle/Resources/translations/messages.en.yml
@@ -110,6 +110,7 @@ header:
overview: overview
navigation:
+ translations: translations
titles:
possible_actions: possible actions
showHideMenu: show/hide menu