Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changed namespace to Knp

  • Loading branch information...
commit a695c009e2f5cff2c0734446152b3e6e5dd707ed 1 parent 68acd00
@docteurklein authored
Showing with 77 additions and 78 deletions.
  1. +2 −2 Controller/EditionController.php
  2. +1 −1  Controller/TranslatorController.php
  3. +1 −1  DependencyInjection/Compiler/TranslatorPass.php
  4. +1 −1  DependencyInjection/Configuration.php
  5. +2 −2 DependencyInjection/{KnplabsTranslatorExtension.php → KnpTranslatorExtension.php}
  6. +3 −3 Dumper/CsvDumper.php
  7. +1 −1  Dumper/DumperInterface.php
  8. +3 −3 Dumper/XliffDumper.php
  9. +3 −3 Dumper/YamlDumper.php
  10. +1 −1  Exception/InvalidTranslationKeyException.php
  11. +1 −1  Features/Context/FeatureContext.php
  12. +3 −3 KnplabsTranslatorBundle.php → KnpTranslatorBundle.php
  13. +5 −5 Listener/ResponseListener.php
  14. +14 −14 README.md
  15. +2 −2 Resources/config/controller.xml
  16. +5 −5 Resources/config/translation.xml
  17. +2 −2 Resources/public/js/translator.js
  18. +4 −0 Resources/translations/KnpTranslatorBundle.en.yml
  19. 0  Resources/translations/{KnplabsTranslatorBundle.fr.yml → KnpTranslatorBundle.fr.yml}
  20. +0 −5 Resources/translations/KnplabsTranslatorBundle.en.yml
  21. +2 −2 Resources/views/Edition/list.html.twig
  22. +1 −1  Resources/views/layout.html.twig
  23. +3 −3 Tests/Dumper/CsvDumperTest.php
  24. +2 −2 Tests/Dumper/DumperTest.php
  25. +3 −3 Tests/Dumper/XliffDumperTest.php
  26. +3 −3 Tests/Dumper/YamlDumperTest.php
  27. +4 −4 Tests/Translation/TranslatorTest.php
  28. +1 −1  Tests/autoload.php.dist
  29. +3 −3 Translation/Translator.php
  30. +1 −1  phpunit.xml.dist
View
4 Controller/EditionController.php
@@ -9,7 +9,7 @@
* with this source code in the file LICENSE.
*/
-namespace Knplabs\Bundle\TranslatorBundle\Controller;
+namespace Knp\Bundle\TranslatorBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
@@ -38,7 +38,7 @@ public function listAction()
$this->translator->setFallbackLocale($fallbackLocale);
- return $this->templating->renderResponse('KnplabsTranslatorBundle:Edition:list.html.twig', array(
+ return $this->templating->renderResponse('KnpTranslatorBundle:Edition:list.html.twig', array(
'translations' => $translations,
'translator' => $this->translator
));
View
2  Controller/TranslatorController.php
@@ -9,7 +9,7 @@
* with this source code in the file LICENSE.
*/
-namespace Knplabs\Bundle\TranslatorBundle\Controller;
+namespace Knp\Bundle\TranslatorBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
View
2  DependencyInjection/Compiler/TranslatorPass.php
@@ -9,7 +9,7 @@
* with this source code in the file LICENSE.
*/
-namespace Knplabs\Bundle\TranslatorBundle\DependencyInjection\Compiler;
+namespace Knp\Bundle\TranslatorBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
View
2  DependencyInjection/Configuration.php
@@ -1,6 +1,6 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\DependencyInjection;
+namespace Knp\Bundle\TranslatorBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder,
Symfony\Component\Config\Definition\ConfigurationInterface;
View
4 ...yInjection/KnplabsTranslatorExtension.php → ...dencyInjection/KnpTranslatorExtension.php
@@ -1,6 +1,6 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\DependencyInjection;
+namespace Knp\Bundle\TranslatorBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
@@ -8,7 +8,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
-class KnplabsTranslatorExtension extends Extension
+class KnpTranslatorExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
View
6 Dumper/CsvDumper.php
@@ -1,11 +1,11 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Dumper;
+namespace Knp\Bundle\TranslatorBundle\Dumper;
-use Knplabs\Bundle\TranslatorBundle\Dumper\DumperInterface;
+use Knp\Bundle\TranslatorBundle\Dumper\DumperInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Yaml\Yaml;
-use Knplabs\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException;
+use Knp\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException;
class CsvDumper implements DumperInterface
{
View
2  Dumper/DumperInterface.php
@@ -1,6 +1,6 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Dumper;
+namespace Knp\Bundle\TranslatorBundle\Dumper;
use Symfony\Component\Config\Resource\FileResource;
View
6 Dumper/XliffDumper.php
@@ -1,9 +1,9 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Dumper;
+namespace Knp\Bundle\TranslatorBundle\Dumper;
-use Knplabs\Bundle\TranslatorBundle\Dumper\DumperInterface;
-use Knplabs\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException;
+use Knp\Bundle\TranslatorBundle\Dumper\DumperInterface;
+use Knp\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\CssSelector\XPathExpr;
use \DOMDocument;
View
6 Dumper/YamlDumper.php
@@ -1,11 +1,11 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Dumper;
+namespace Knp\Bundle\TranslatorBundle\Dumper;
-use Knplabs\Bundle\TranslatorBundle\Dumper\DumperInterface;
+use Knp\Bundle\TranslatorBundle\Dumper\DumperInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Yaml\Yaml;
-use Knplabs\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException;
+use Knp\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException;
class YamlDumper implements DumperInterface
{
View
2  Exception/InvalidTranslationKeyException.php
@@ -1,6 +1,6 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Exception;
+namespace Knp\Bundle\TranslatorBundle\Exception;
class InvalidTranslationKeyException extends \Exception
{
View
2  Features/Context/FeatureContext.php
@@ -1,6 +1,6 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Features\Context;
+namespace Knp\Bundle\TranslatorBundle\Features\Context;
use Behat\BehatBundle\Context\MinkContext;
use Behat\Behat\Context\ClosuredContextInterface,
View
6 KnplabsTranslatorBundle.php → KnpTranslatorBundle.php
@@ -9,13 +9,13 @@
* with this source code in the file LICENSE.
*/
-namespace Knplabs\Bundle\TranslatorBundle;
+namespace Knp\Bundle\TranslatorBundle;
-use Knplabs\Bundle\TranslatorBundle\DependencyInjection\Compiler\TranslatorPass;
+use Knp\Bundle\TranslatorBundle\DependencyInjection\Compiler\TranslatorPass;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-class KnplabsTranslatorBundle extends Bundle
+class KnpTranslatorBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
View
10 Listener/ResponseListener.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Knplabs\Bundle\TranslatorBundle\Listener;
+namespace Knp\Bundle\TranslatorBundle\Listener;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -78,18 +78,18 @@ protected function injectScripts(Response $response)
$scripts = '';
if(true === $this->includeVendorAssets) {
- $url = $this->assetHelper->getUrl('bundles/knplabstranslator/js/ext-core.js');
+ $url = $this->assetHelper->getUrl('bundles/knptranslator/js/ext-core.js');
$scripts = sprintf('<script type="text/javascript" src="%s"></script>', $url)."\n";
}
- $url = $this->assetHelper->getUrl('bundles/knplabstranslator/js/translator.js');
+ $url = $this->assetHelper->getUrl('bundles/knptranslator/js/translator.js');
$scripts .= sprintf('<script type="text/javascript" src="%s"></script>', $url)."\n";
$script= <<<HTML
<script type="text/javascript">
Ext.onReady(function() {
- new Knplabs.Translator({
+ new Knp.Translator({
url: '%s'
});
});
@@ -121,7 +121,7 @@ protected function injectCss(Response $response)
if (false !== $pos = $posrFunction($content, '</head>')) {
- $url = $this->assetHelper->getUrl('bundles/knplabstranslator/css/translator.css');
+ $url = $this->assetHelper->getUrl('bundles/knptranslator/css/translator.css');
$links = sprintf('<link rel="stylesheet" href="%s" />', $url);
$content = $substrFunction($content, 0, $pos).$links.$substrFunction($content, $pos);
View
28 README.md
@@ -20,7 +20,7 @@ Install & setup the bundle
``` bash
- git submodule add git://github.com/docteurklein/TranslatorBundle.git vendor/bundles/Knplabs/Bundle/TranslatorBundle
+ git submodule add git://github.com/docteurklein/TranslatorBundle.git vendor/bundles/Knp/Bundle/TranslatorBundle
```
@@ -28,7 +28,7 @@ Install & setup the bundle
``` bash
- mkdir -p vendor/bundles/Knplabs/Bundle
+ mkdir -p vendor/bundles/Knp/Bundle
cd !$
git clone git://github.com/docteurklein/TranslatoBundle.git
@@ -43,7 +43,7 @@ Install & setup the bundle
{
$bundles = array(
// ...
- new Knplabs\Bundle\TranslatorBundle\KnplabsTranslatorBundle,
+ new Knp\Bundle\TranslatorBundle\KnpTranslatorBundle,
// ...
);
// ...
@@ -51,13 +51,13 @@ Install & setup the bundle
```
-3. Add the Knplabs namespace to your autoloader
+3. Add the Knp namespace to your autoloader
```php
// app/autoload.php
$loader->registerNamespaces(array(
- 'Knplabs' => __DIR__.'/../vendor/bundles',
+ 'Knp' => __DIR__.'/../vendor/bundles',
// your other namespaces
);
@@ -70,11 +70,11 @@ Install & setup the bundle
// app/config/routing.yml
knplabs_translator_admin:
- resource: @KnplabsTranslatorBundle/Resources/config/routing/edition.yml
+ resource: @KnpTranslatorBundle/Resources/config/routing/edition.yml
prefix: /trans/admin
knplabs_translator:
- resource: @KnplabsTranslatorBundle/Resources/config/routing/routing.yml
+ resource: @KnpTranslatorBundle/Resources/config/routing/routing.yml
prefix: /trans
```
@@ -124,15 +124,15 @@ Services
This bundle introduces those services:
- translator.dumper.csv container Knplabs\Bundle\TranslatorBundle\Dumper\CsvDumper
- translator.dumper.xliff container Knplabs\Bundle\TranslatorBundle\Dumper\XliffDumper
- translator.dumper.yaml container Knplabs\Bundle\TranslatorBundle\Dumper\YamlDumper
- translator.writer container Knplabs\Bundle\TranslatorBundle\Translation\Translator
+ translator.dumper.csv container Knp\Bundle\TranslatorBundle\Dumper\CsvDumper
+ translator.dumper.xliff container Knp\Bundle\TranslatorBundle\Dumper\XliffDumper
+ translator.dumper.yaml container Knp\Bundle\TranslatorBundle\Dumper\YamlDumper
+ translator.writer container Knp\Bundle\TranslatorBundle\Translation\Translator
controllers are services too:
- knplabs_translator.controller.edition request Knplabs\Bundle\TranslatorBundle\Controller\EditionController
- knplabs_translator.controller.translator request Knplabs\Bundle\TranslatorBundle\Controller\TranslatorController
+ knplabs_translator.controller.edition request Knp\Bundle\TranslatorBundle\Controller\EditionController
+ knplabs_translator.controller.translator request Knp\Bundle\TranslatorBundle\Controller\TranslatorController
API
@@ -140,7 +140,7 @@ API
``` php
- class Knplabs\Bundle\TranslatorBundle\Translation\Translator extends Symfony\Bundle\FrameworkBundle\Translation\Translator
+ class Knp\Bundle\TranslatorBundle\Translation\Translator extends Symfony\Bundle\FrameworkBundle\Translation\Translator
{
// equivalent of parent::trans
View
4 Resources/config/controller.xml
@@ -5,13 +5,13 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
- <service id="knplabs_translator.controller.translator" class="Knplabs\Bundle\TranslatorBundle\Controller\TranslatorController" scope="request">
+ <service id="knplabs_translator.controller.translator" class="Knp\Bundle\TranslatorBundle\Controller\TranslatorController" scope="request">
<argument type="service" id="request" />
<argument type="service" id="translator.writer" />
<argument type="service" id="logger" />
</service>
- <service id="knplabs_translator.controller.edition" class="Knplabs\Bundle\TranslatorBundle\Controller\EditionController" scope="request">
+ <service id="knplabs_translator.controller.edition" class="Knp\Bundle\TranslatorBundle\Controller\EditionController" scope="request">
<argument type="service" id="request" />
<argument type="service" id="translator.writer" />
<argument type="service" id="templating" />
View
10 Resources/config/translation.xml
@@ -9,7 +9,7 @@
</parameters>
<services>
- <service id="translator.writer" class="Knplabs\Bundle\TranslatorBundle\Translation\Translator">
+ <service id="translator.writer" class="Knp\Bundle\TranslatorBundle\Translation\Translator">
<argument type="service" id="service_container" />
<argument type="service" id="translator.selector" />
<argument type="collection" /> <!-- translation loaders -->
@@ -20,17 +20,17 @@
<argument type="service" id="session" on-invalid="ignore" />
</service>
- <service id="translator.dumper.yaml" class="Knplabs\Bundle\TranslatorBundle\Dumper\YamlDumper">
+ <service id="translator.dumper.yaml" class="Knp\Bundle\TranslatorBundle\Dumper\YamlDumper">
<tag name="knplabs_translator.dumper"/>
</service>
- <service id="translator.dumper.xliff" class="Knplabs\Bundle\TranslatorBundle\Dumper\XliffDumper">
+ <service id="translator.dumper.xliff" class="Knp\Bundle\TranslatorBundle\Dumper\XliffDumper">
<tag name="knplabs_translator.dumper"/>
</service>
- <service id="translator.dumper.csv" class="Knplabs\Bundle\TranslatorBundle\Dumper\CsvDumper">
+ <service id="translator.dumper.csv" class="Knp\Bundle\TranslatorBundle\Dumper\CsvDumper">
<tag name="knplabs_translator.dumper"/>
</service>
- <service id="translator.response.listener.assets_injecter" class="Knplabs\Bundle\TranslatorBundle\Listener\ResponseListener" scope="request">
+ <service id="translator.response.listener.assets_injecter" class="Knp\Bundle\TranslatorBundle\Listener\ResponseListener" scope="request">
<argument type="service" id="templating.helper.assets" />
<argument type="service" id="router" />
<argument>%knplabs.translator.include_vendor_assets%</argument>
View
4 Resources/public/js/translator.js
@@ -1,7 +1,7 @@
-Ext.namespace('Knplabs');
+Ext.namespace('Knp');
-Knplabs.Translator = Ext.extend(Ext.util.Observable, {
+Knp.Translator = Ext.extend(Ext.util.Observable, {
config: {}
,form: null
View
4 Resources/translations/KnpTranslatorBundle.en.yml
@@ -0,0 +1,4 @@
+knplabs_translator:
+ title: Translator
+ list: 'It''s alive, ALIVE!'
+ edit: 'Edit a translation'
View
0  ...anslations/KnplabsTranslatorBundle.fr.yml → ...s/translations/KnpTranslatorBundle.fr.yml
File renamed without changes
View
5 Resources/translations/KnplabsTranslatorBundle.en.yml
@@ -1,5 +0,0 @@
-knplabs_translator:
- title: Translator
- list: List of translations
- edit: Edit a translation
-
View
4 Resources/views/Edition/list.html.twig
@@ -1,8 +1,8 @@
-{% extends 'KnplabsTranslatorBundle::layout.html.twig' %}
+{% extends 'KnpTranslatorBundle::layout.html.twig' %}
{% block content %}
-<h1>{{ 'knplabs_translator.list'|trans({}, 'KnplabsTranslatorBundle') }}</h1>
+<h1>{{ 'knplabs_translator.list'|trans({}, 'KnpTranslatorBundle') }}</h1>
{% for locale in translations|keys %}
View
2  Resources/views/layout.html.twig
@@ -6,7 +6,7 @@
<body>
{% for key, flash in app.session.getFlashes() %}
<div class="{{ flash }}">
- {{ key|trans({}, 'KnplabsTranslatorBundle') }}
+ {{ key|trans({}, 'KnpTranslatorBundle') }}
</div>
{% endfor %}
View
6 Tests/Dumper/CsvDumperTest.php
@@ -1,8 +1,8 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Tests\Dumper;
+namespace Knp\Bundle\TranslatorBundle\Tests\Dumper;
-use Knplabs\Bundle\TranslatorBundle\Dumper\CsvDumper;
+use Knp\Bundle\TranslatorBundle\Dumper\CsvDumper;
class CsvDumperTest extends DumperTest
{
@@ -34,7 +34,7 @@ public function testUpdateReturnValue()
}
/**
- * @expectedException Knplabs\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException
+ * @expectedException Knp\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException
* @dataProvider provideInvalidKeys
*/
public function testUpdateWithInvalidKey($key, $value)
View
4 Tests/Dumper/DumperTest.php
@@ -1,8 +1,8 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Tests\Dumper;
+namespace Knp\Bundle\TranslatorBundle\Tests\Dumper;
-use Knplabs\Bundle\TranslatorBundle\Dumper\DumperInterface;
+use Knp\Bundle\TranslatorBundle\Dumper\DumperInterface;
abstract class DumperTest extends \PHPUnit_Framework_TestCase
{
View
6 Tests/Dumper/XliffDumperTest.php
@@ -1,8 +1,8 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Tests\Dumper;
+namespace Knp\Bundle\TranslatorBundle\Tests\Dumper;
-use Knplabs\Bundle\TranslatorBundle\Dumper\XliffDumper;
+use Knp\Bundle\TranslatorBundle\Dumper\XliffDumper;
class XliffDumperTest extends DumperTest
{
@@ -35,7 +35,7 @@ public function testUpdateReturnValue()
}
/**
- * @expectedException Knplabs\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException
+ * @expectedException Knp\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException
* @dataProvider provideInvalidKeys
*/
public function testUpdateWithInvalidKey($key, $value)
View
6 Tests/Dumper/YamlDumperTest.php
@@ -1,8 +1,8 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Tests\Dumper;
+namespace Knp\Bundle\TranslatorBundle\Tests\Dumper;
-use Knplabs\Bundle\TranslatorBundle\Dumper\YamlDumper;
+use Knp\Bundle\TranslatorBundle\Dumper\YamlDumper;
class YamlDumperTest extends DumperTest
{
@@ -35,7 +35,7 @@ public function testUpdateReturnValue()
}
/**
- * @expectedException Knplabs\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException
+ * @expectedException Knp\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException
* @dataProvider provideInvalidKeys
*/
public function testUpdateWithInvalidKey($key, $value)
View
8 Tests/Translation/TranslatorTest.php
@@ -1,13 +1,13 @@
<?php
-namespace Knplabs\Bundle\TranslatorBundle\Tests\Translation;
+namespace Knp\Bundle\TranslatorBundle\Tests\Translation;
use Symfony\Component\Translation\MessageSelector;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Loader\YamlFileLoader;
-use Knplabs\Bundle\TranslatorBundle\Translation\Translator;
-use Knplabs\Bundle\TranslatorBundle\Dumper\YamlDumper;
-use Knplabs\Bundle\TranslatorBundle\Tests\Dumper\DumperTest;
+use Knp\Bundle\TranslatorBundle\Translation\Translator;
+use Knp\Bundle\TranslatorBundle\Dumper\YamlDumper;
+use Knp\Bundle\TranslatorBundle\Tests\Dumper\DumperTest;
use Symfony\Component\Translation\Loader\XliffFileLoader;
class TranslatorTest extends DumperTest
View
2  Tests/autoload.php.dist
@@ -8,6 +8,6 @@ use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
'Symfony' => array($vendorDir.'/symfony/src', $vendorDir.'/bundles'),
- 'Knplabs' => $vendorDir.'/bundles',
+ 'Knp' => $vendorDir.'/bundles',
));
$loader->register();
View
6 Translation/Translator.php
@@ -9,13 +9,13 @@
* file that was distributed with this source code.
*/
-namespace Knplabs\Bundle\TranslatorBundle\Translation;
+namespace Knp\Bundle\TranslatorBundle\Translation;
use Symfony\Bundle\FrameworkBundle\Translation\Translator as BaseTranslator;
use Symfony\Component\Config\Resource\ResourceInterface;
-use Knplabs\Bundle\TranslatorBundle\Dumper\DumperInterface;
+use Knp\Bundle\TranslatorBundle\Dumper\DumperInterface;
use Symfony\Component\Translation\MessageCatalogue;
-use Knplabs\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException;
+use Knp\Bundle\TranslatorBundle\Exception\InvalidTranslationKeyException;
/**
* Translator that adds write capabilites on translation files
View
2  phpunit.xml.dist
@@ -19,7 +19,7 @@
</php>
-->
<testsuites>
- <testsuite name="KnplabsTranslatorBundle">
+ <testsuite name="KnpTranslatorBundle">
<directory suffix="Test.php">./Tests</directory>
</testsuite>
</testsuites>
Please sign in to comment.
Something went wrong with that request. Please try again.