Initial LocaleBundle for managing locales and changing them in frontend

This commit is contained in:
Paweł Jędrzejewski 2014-06-28 19:08:44 +02:00
parent ca90452139
commit 788ac86fb8
130 changed files with 2016 additions and 222 deletions

View file

@ -202,6 +202,7 @@ default:
- Sylius\Bundle\ResourceBundle\Behat\BaseContext
- Sylius\Bundle\ShippingBundle\Behat\ShippingContext
- Sylius\Bundle\TaxationBundle\Behat\TaxationContext
- Sylius\Bundle\TaxonomyBundle\Behat\TaxonomyContext
- Sylius\Bundle\WebBundle\Behat\WebContext
- Sylius\Bundle\MoneyBundle\Behat\MoneyContext
filters:

View file

@ -86,6 +86,8 @@
"sylius/installer-bundle": "self.version",
"sylius/inventory": "self.version",
"sylius/inventory-bundle": "self.version",
"sylius/locale": "self.version",
"sylius/locale-bundle": "self.version",
"sylius/money-bundle": "self.version",
"sylius/order": "self.version",
"sylius/order-bundle": "self.version",

View file

@ -1,72 +0,0 @@
@localization
Feature: Managing locales
In order to reach customers from different countries
As a store owner
I want to be able to configure locales
Background:
Given I am logged in as administrator
And there is default currency configured
And there are following locales configured:
| code | activated |
| de_DE | yes |
| en_US | no |
| fr_FR | yes |
Scenario: Seeing index of all locales
Given I am on the dashboard page
When I follow "Locales"
Then I should be on the locale index page
And I should see 3 locales in the list
Scenario: Seeing empty index of locales
Given there are no locales
And I am on the locale index page
Then I should see "There are no locales configured"
Scenario: Accessing the locale adding form
Given I am on the dashboard page
When I follow "Locales"
And I follow "Create locale"
Then I should be on the locale creation page
Scenario: Submitting invalid form without code
Given I am on the locale creation page
When I press "Create"
Then I should still be on the locale creation page
And I should see "Please enter locale code"
Scenario: Creating new locale
Given I am on the locale creation page
When I fill in "Code" with "pl_PL"
And I press "Create"
Then I should be on the locale index page
And I should see "Locale has been successfully created."
Scenario: Locales have to be unique
Given I am on the locale creation page
When I fill in "Code" with "de_DE"
And I press "Create"
Then I should still be on the locale creation page
And I should see "This locale already exists."
Scenario: Accessing the editing form from the list
Given I am on the locale index page
When I click "edit" near "de_DE"
Then I should be editing locale with code "de_DE"
Scenario: Updating the locale
Given I am editing locale with code "en_US"
When I fill in "Code" with "en_GB"
And I press "Save changes"
Then I should be on the locale index page
And I should see "Locale has been successfully updated."
@javascript
Scenario: Deleting locale from list
Given I am on the locale index page
When I click "delete" near "de_DE"
And I click "delete" from the confirmation modal
Then I should be on the locale index page
And I should see "Locale has been successfully deleted."
And I should not see locale with name "de_DE" in that list

View file

@ -0,0 +1,66 @@
@localization
Feature: Managing locales
In order to reach customers from different countries
As a store owner
I want to be able to configure locales
Background:
Given I am logged in as administrator
And there are following currencies configured:
| code | exchange rate | enabled |
| EUR | 1.00000 | yes |
And there are following locales configured:
| code | activated |
| de_DE | yes |
| en_US | no |
| fr_FR | yes |
Scenario: Seeing index of all locales
Given I am on the dashboard page
When I follow "Locales"
Then I should be on the locale index page
And I should see 3 locales in the list
Scenario: Seeing empty index of locales
Given there are no locales
And I am on the locale index page
Then I should see "There are no locales configured"
Scenario: Accessing the locale adding form
Given I am on the dashboard page
When I follow "Locales"
And I follow "Create locale"
Then I should be on the locale creation page
Scenario: Creating new locale
Given I am on the locale creation page
When I fill in "Code" with "pl_PL"
And I press "Create"
Then I should be on the locale index page
And I should see "Locale has been successfully created."
Scenario: Locales have to be unique
Given I am on the locale creation page
When I fill in "Code" with "de_DE"
And I press "Create"
Then I should still be on the locale creation page
And I should see "This locale already exists."
Scenario: Accessing the editing form from the list
Given I am on the locale index page
When I click "edit" near "de_DE"
Then I should be editing locale with code "de_DE"
Scenario: Updating the locale
Given I am editing locale with code "en_US"
When I fill in "Code" with "en_GB"
And I press "Save changes"
Then I should be on the locale index page
And I should see "Locale has been successfully updated."
Scenario: Deleting locale from list
Given I am on the locale index page
When I click "delete" near "de_DE"
Then I should be on the locale index page
And I should see "Locale has been successfully deleted."
And I should not see locale with name "de_DE" in that list

View file

@ -0,0 +1,29 @@
@localization
Feature: Locale selection
In order to browse the website in my preferred language
As a customer
I want to to select my language in the storefront
Background:
And there are following locales configured:
| code | enabled |
| de_DE | yes |
| en_US | yes |
| fr_FR | no |
| pl_PL | yes |
Scenario: Only enabled locales are visible to the user
Given I am on the store homepage
Then I should see 3 available locales
And I should browse the store in English
Scenario: Changing the locale in storefront
Given I am on the store homepage
When I change the locale to Polish
Then I should browse the store in Polish
Scenario: Switching the locale as a logged in customer
Given I am logged in user
And I am on the store homepage
When I change the locale to German
Then I should browse the store in German

View file

@ -3,9 +3,10 @@ suites:
Attribute : { namespace: Sylius, spec_path: src/Sylius/Component/Attribute }
Cart : { namespace: Sylius, spec_path: src/Sylius/Component/Cart }
Core : { namespace: Sylius, spec_path: src/Sylius/Component/Core }
Currency : { namespace: Sylius, spec_path: src/Sylius/Component/Currency }
Installer : { namespace: Sylius, spec_path: src/Sylius/Component/Installer }
Inventory : { namespace: Sylius, spec_path: src/Sylius/Component/Inventory }
Currency : { namespace: Sylius, spec_path: src/Sylius/Component/Currency }
Locale : { namespace: Sylius, spec_path: src/Sylius/Component/Locale }
Order : { namespace: Sylius, spec_path: src/Sylius/Component/Order }
Payment : { namespace: Sylius, spec_path: src/Sylius/Component/Payment }
Payum : { namespace: Sylius, spec_path: src/Sylius/Component/Payum }
@ -14,8 +15,8 @@ suites:
Promotion : { namespace: Sylius, spec_path: src/Sylius/Component/Promotion }
Registry : { namespace: Sylius, spec_path: src/Sylius/Component/Registry }
Resource : { namespace: Sylius, spec_path: src/Sylius/Component/Resource }
Settings : { namespace: Sylius, spec_path: src/Sylius/Component/Settings }
Sequence : { namespace: Sylius, spec_path: src/Sylius/Component/Sequence }
Settings : { namespace: Sylius, spec_path: src/Sylius/Component/Settings }
Shipping : { namespace: Sylius, spec_path: src/Sylius/Component/Shipping }
Taxation : { namespace: Sylius, spec_path: src/Sylius/Component/Taxation }
Taxonomy : { namespace: Sylius, spec_path: src/Sylius/Component/Taxonomy }
@ -29,6 +30,7 @@ suites:
FlowBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/FlowBundle }
InstallerBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/InstallerBundle }
InventoryBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/InventoryBundle }
LocaleBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/LocaleBundle }
MoneyBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/MoneyBundle }
OrderBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/OrderBundle }
PaymentBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/PaymentBundle }

View file

@ -123,14 +123,6 @@ class Configuration implements ConfigurationInterface
->scalarNode('form')->defaultValue('Sylius\Bundle\CoreBundle\Form\Type\GroupType')->end()
->end()
->end()
->arrayNode('locale')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue('Sylius\Component\Core\Model\Locale')->end()
->scalarNode('controller')->defaultValue('Sylius\Bundle\ResourceBundle\Controller\ResourceController')->end()
->scalarNode('form')->defaultValue('Sylius\Bundle\CoreBundle\Form\Type\LocaleType')->end()
->end()
->end()
->arrayNode('block')
->addDefaultsIfNotSet()
->children()

View file

@ -30,6 +30,7 @@ class SyliusCoreExtension extends AbstractResourceExtension implements PrependEx
'sylius_addressing',
'sylius_inventory',
'sylius_currency',
'sylius_locale',
'sylius_payment',
'sylius_payum',
'sylius_product',

View file

@ -1,37 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\CoreBundle\EventListener;
use Sylius\Bundle\SettingsBundle\Manager\SettingsManagerInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
/**
* Sets currently selected locale on request object.
*
* @author Saša Stamenković <umpirsky@gmail.com>
*/
class LocaleListener
{
protected $settingsManager;
public function __construct(SettingsManagerInterface $settingsManager)
{
$this->settingsManager = $settingsManager;
}
public function setRequestLocale(GetResponseEvent $event)
{
$event->getRequest()->setLocale(
$this->settingsManager->loadSettings('general')->get('locale')
);
}
}

View file

@ -38,6 +38,7 @@ abstract class Kernel extends BaseKernel
new \Sylius\Bundle\OrderBundle\SyliusOrderBundle(),
new \Sylius\Bundle\MoneyBundle\SyliusMoneyBundle(),
new \Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle(),
new \Sylius\Bundle\LocaleBundle\SyliusLocaleBundle(),
new \Sylius\Bundle\SettingsBundle\SyliusSettingsBundle(),
new \Sylius\Bundle\CartBundle\SyliusCartBundle(),
new \Sylius\Bundle\ProductBundle\SyliusProductBundle(),

View file

@ -143,11 +143,6 @@ sylius_resource:
driver: doctrine/orm
classes:
model: Sylius\Component\Core\Model\Group
sylius.locale:
driver: doctrine/orm
classes:
model: Sylius\Component\Core\Model\Locale
controller: Sylius\Bundle\ResourceBundle\Controller\ResourceController
sylius.block:
driver: doctrine/phpcr-odm
classes:

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Sylius\Component\Core\Model\Locale" table="sylius_locale">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
<field name="code" column="code" type="string" />
<field name="enabled" column="enabled" type="boolean" />
</mapped-superclass>
</doctrine-mapping>

View file

@ -43,7 +43,6 @@
<parameter key="sylius.listener.purchase.class">Sylius\Bundle\CoreBundle\EventListener\PurchaseListener</parameter>
<parameter key="sylius.listener.insufficient_stock_exception.class">Sylius\Bundle\CoreBundle\EventListener\InsufficientStockExceptionListener</parameter>
<parameter key="sylius.listener.image_upload.class">Sylius\Bundle\CoreBundle\EventListener\ImageUploadListener</parameter>
<parameter key="sylius.listener.locale.class">Sylius\Bundle\CoreBundle\EventListener\LocaleListener</parameter>
<parameter key="sylius.checkout_form.addressing.class">Sylius\Bundle\CoreBundle\Form\Type\Checkout\AddressingStepType</parameter>
<parameter key="sylius.checkout_form.shipping.class">Sylius\Bundle\CoreBundle\Form\Type\Checkout\ShippingStepType</parameter>
@ -169,10 +168,6 @@
<argument>%sylius.model.group.class%</argument>
<tag name="form.type" alias="sylius_group" />
</service>
<service id="sylius.form.type.locale" class="%sylius.form.type.locale.class%">
<argument>%sylius.model.locale.class%</argument>
<tag name="form.type" alias="sylius_locale" />
</service>
<service id="sylius.form.type.block" class="%sylius.form.type.block.class%">
<argument>%sylius.model.block.class%</argument>
<tag name="form.type" alias="sylius_block" />
@ -351,10 +346,6 @@
<tag name="kernel.event_listener" event="sylius.taxonomy.pre_create" method="uploadTaxonomyImage" />
<tag name="kernel.event_listener" event="sylius.taxonomy.pre_update" method="uploadTaxonomyImage" />
</service>
<service id="sylius.listener.locale" class="%sylius.listener.locale.class%">
<argument type="service" id="sylius.settings.manager" />
<tag name="kernel.event_listener" event="kernel.request" method="setRequestLocale" />
</service>
<service id="sylius.form.type.image" class="%sylius.form.type.image.class%">
<argument>%sylius.model.product_variant_image.class%</argument>

View file

@ -141,25 +141,6 @@
</property>
</class>
<class name="Sylius\Component\Core\Model\Locale">
<constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
<option name="fields">
<value>code</value>
</option>
<option name="message">sylius.locale.code.unique</option>
<option name="groups">
<value>sylius</value>
</option>
</constraint>
<property name="code">
<constraint name="NotBlank">
<option name="message">sylius.locale.code.not_blank</option>
<option name="groups">
<value>sylius</value>
</option>
</constraint>
</property>
</class>
<class name="Sylius\Component\Cart\Model\CartItem">
<constraint name="Sylius\Bundle\InventoryBundle\Validator\Constraints\InStock">

View file

@ -37,6 +37,7 @@
"sylius/money-bundle": "0.11.*@dev",
"sylius/currency-bundle": "0.11.*@dev",
"sylius/order-bundle": "0.11.*@dev",
"sylius/locale-bundle": "0.11.*@dev",
"sylius/pricing-bundle": "0.11.*@dev",
"sylius/payment-bundle": "0.11.*@dev",
"sylius/payum-bundle": "0.11.*@dev",

View file

@ -1,47 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Sylius\Bundle\CoreBundle\EventListener;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\SettingsBundle\Manager\SettingsManagerInterface;
use Sylius\Bundle\SettingsBundle\Model\Settings;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
class LocaleListenerSpec extends ObjectBehavior
{
function let(SettingsManagerInterface $settingsManager)
{
$this->beConstructedWith($settingsManager);
}
function it_is_initializable()
{
$this->shouldHaveType('Sylius\Bundle\CoreBundle\EventListener\LocaleListener');
}
function it_sets_locale_on_request(
$settingsManager,
GetResponseEvent $event,
Settings $settings,
Request $request
)
{
$settingsManager->loadSettings('general')->willReturn($settings);
$settings->get('locale')->willReturn('en');
$event->getRequest()->willReturn($request);
$request->setLocale('en')->shouldBeCalled();
$this->setRequestLocale($event);
}
}

View file

@ -0,0 +1,5 @@
vendor/
bin/
composer.phar
composer.lock

View file

@ -0,0 +1,13 @@
language: php
php:
- 5.3
- 5.4
- 5.5
before_script: composer install --prefer-source --no-interaction
script: bin/phpspec run -fpretty --verbose
notifications:
irc: "irc.freenode.org#sylius-dev"

View file

@ -0,0 +1,6 @@
CHANGELOG
=========
### v0.11.0
* Initial dev release.

View file

@ -0,0 +1,66 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\LocaleBundle\Context;
use Sylius\Component\Locale\Context\LocaleContextInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
* Default locale context implementation, which uses session to store the user selected locale.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class LocaleContext implements LocaleContextInterface
{
// Key used to store the locale in session.
const SESSION_KEY = '_sylius.locale';
/**
* @var SessionInterface
*/
protected $session;
/**
* @var string
*/
protected $defaultLocale;
public function __construct(SessionInterface $session, $defaultLocale)
{
$this->session = $session;
$this->defaultLocale = $defaultLocale;
}
/**
* {@inheritdoc}
*/
public function getDefaultLocale()
{
return $this->defaultLocale;
}
/**
* {@inheritdoc}
*/
public function getLocale()
{
return $this->session->get(self::SESSION_KEY, $this->defaultLocale);
}
/**
* {@inheritdoc}
*/
public function setLocale($locale)
{
return $this->session->set(self::SESSION_KEY, $locale);
}
}

View file

@ -0,0 +1,35 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\LocaleBundle\Controller;
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Symfony\Component\HttpFoundation\Request;
/**
* Locale controller.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class LocaleController extends ResourceController
{
public function changeAction(Request $request, $locale)
{
$this->getLocaleContext()->setLocale($locale);
return $this->redirect($request->headers->get('referer'));
}
protected function getLocaleContext()
{
return $this->get('sylius.context.locale');
}
}

View file

@ -0,0 +1,97 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\LocaleBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This class contains the configuration information for the bundle.
*
* This information is solely responsible for how the different configuration
* sections are normalized, and merged.
*
* @author Paweł Jędrzejewski <pjedrzejewski@diweb.pl>
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sylius_locale');
$rootNode
->children()
->scalarNode('driver')->isRequired()->cannotBeEmpty()->end()
->end()
;
$this->addValidationGroupsSection($rootNode);
$this->addClassesSection($rootNode);
return $treeBuilder;
}
/**
* Adds `validation_groups` section.
*
* @param ArrayNodeDefinition $node
*/
private function addValidationGroupsSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('locale')
->prototype('scalar')->end()
->defaultValue(array('sylius'))
->end()
->end()
->end()
->end()
;
}
/**
* Adds `classes` section.
*
* @param ArrayNodeDefinition $node
*/
private function addClassesSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->arrayNode('locale')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue('Sylius\Component\Locale\Model\Locale')->end()
->scalarNode('controller')->defaultValue('Sylius\Bundle\LocaleBundle\Controller\LocaleController')->end()
->scalarNode('repository')->end()
->scalarNode('form')->defaultValue('Sylius\Bundle\LocaleBundle\Form\Type\LocaleType')->end()
->end()
->end()
->end()
->end()
->end()
;
}
}

View file

@ -0,0 +1,37 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\LocaleBundle\DependencyInjection;
use Sylius\Bundle\ResourceBundle\DependencyInjection\AbstractResourceExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Locale extension.
*
* @author Paweł Jędrzejewski <pjedrzejewski@sylius.pl>
*/
class SyliusLocaleExtension extends AbstractResourceExtension
{
protected $configFiles = array(
'services',
'templating',
'twig',
);
/**
* {@inheritdoc}
*/
public function load(array $config, ContainerBuilder $container)
{
$this->configure($config, new Configuration(), $container, self::CONFIGURE_LOADER | self::CONFIGURE_DATABASE | self::CONFIGURE_PARAMETERS | self::CONFIGURE_VALIDATORS);
}
}

View file

@ -0,0 +1,61 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\LocaleBundle\EventListener;
use Sylius\Component\Locale\Context\LocaleContextInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
/**
* Used to set the right locale on the request.
*
* @author Paweł Jędrzejewski <pawel@sylius.org>
*/
class LocaleListener implements EventSubscriberInterface
{
/**
* @var LocaleContextInterface
*/
protected $localeContext;
/**
* @param LocaleContextinterface $localeContext
*/
public function __construct(LocaleContextInterface $localeContext)
{
$this->localeContext = $localeContext;
}
/**
* Set the right locale via context.
*
* @param GetResponseEvent $event
*/
public function onKernelRequest(GetResponseEvent $event)
{
$request = $event->getRequest();
if (!$request->hasPreviousSession()) {
return;
}
$request->setLocale($this->localeContext->getLocale() ?: $this->localeContext->getDefaultLocale());
}
public static function getSubscribedEvents()
{
return array(
KernelEvents::REQUEST => array(array('onKernelRequest', 17)),
);
}
}

View file

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\CoreBundle\Form\Type;
namespace Sylius\Bundle\LocaleBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
@ -22,17 +22,26 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface;
*/
class LocaleType extends AbstractType
{
/**
* @var string
*/
private $dataClass;
/**
* @param string $dataClass
*/
public function __construct($dataClass)
{
$this->dataClass = $dataClass;
}
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('code', 'text', array(
->add('code', 'locale', array(
'label' => 'sylius.form.locale.code'
))
->add('enabled', 'checkbox', array(
@ -43,6 +52,9 @@ class LocaleType extends AbstractType
}
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver
@ -53,6 +65,9 @@ class LocaleType extends AbstractType
);
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_locale';

View file

@ -0,0 +1,80 @@
SyliusCurrencyBundle [![Build status...](https://secure.travis-ci.org/Sylius/SyliusCurrencyBundle.png?branch=master)](http://travis-ci.org/Sylius/SyliusCurrencyBundle)
====================
[**Symfony2**](http://symfony.com) integration of Sylius Currency processing
component.
Sylius
------
**Sylius** - Modern ecommerce for Symfony2. Visit [Sylius.org](http://sylius.org).
[phpspec](http://phpspec.net) examples
--------------------------------------
```bash
$ composer install
$ bin/phpspec run -f pretty
```
Documentation
-------------
Documentation is available on [**docs.sylius.org**](http://sylius.org/en/latest/bundles/SyliusInventoryBundle/index.html).
Code examples
-------------
If you want to see working implementation, try out the [Sylius sandbox application](http://github.com/Sylius/Sylius-Sandbox).
Contributing
------------
All informations about contributing to Sylius can be found on [this page](http://docs.sylius.org/en/latest/contributing/index.html).
Mailing lists
-------------
### Users
Questions? Feel free to ask on [users mailing list](http://groups.google.com/group/sylius).
### Developers
To contribute and develop this bundle, use the [developers mailing list](http://groups.google.com/group/sylius-dev).
Sylius twitter account
----------------------
If you want to keep up with updates, [follow the official Sylius account on twitter](http://twitter.com/Sylius).
Bug tracking
------------
This bundle uses [GitHub issues](https://github.com/Sylius/SyliusCurrencyBundle/issues).
If you have found bug, please create an issue.
Versioning
----------
Releases will be numbered with the format `major.minor.patch`.
And constructed with the following guidelines.
* Breaking backwards compatibility bumps the major.
* New additions without breaking backwards compatibility bumps the minor.
* Bug fixes and misc changes bump the patch.
For more information on SemVer, please visit [semver.org website](http://semver.org/)...
This versioning method is same for all **Sylius** bundles and applications.
MIT License
-----------
License can be found [here](https://github.com/Sylius/SyliusCurrencyBundle/blob/master/Currencys/meta/LICENSE).
Authors
-------
The bundle was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com).
See the list of [contributors](https://github.com/Sylius/SyliusCurrencyBundle/contributors).

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<mapped-superclass name="Sylius\Component\Locale\Model\Locale" table="sylius_locale">
<id name="id" column="id" type="integer">
<generator strategy="AUTO" />
</id>
<field name="code" column="code" type="string" length="12" />
<field name="enabled" column="enabled" type="boolean" />
<field name="createdAt" column="created_at" type="datetime">
<gedmo:timestampable on="create"/>
</field>
<field name="updatedAt" column="updated_at" type="datetime" nullable="true">
<gedmo:timestampable on="update"/>
</field>
</mapped-superclass>
</doctrine-mapping>

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.context.locale.class">Sylius\Bundle\LocaleBundle\Context\LocaleContext</parameter>
<parameter key="sylius.locale_provider.class">Sylius\Component\Locale\Provider\LocaleProvider</parameter>
<parameter key="sylius.event_listener.locale.class">Sylius\Bundle\LocaleBundle\EventListener\LocaleListener</parameter>
</parameters>
<services>
<service id="sylius.form.type.locale" class="%sylius.form.type.locale.class%">
<argument>%sylius.model.locale.class%</argument>
<argument>%sylius.validation_group.locale%</argument>
<tag name="form.type" alias="sylius_locale" />
</service>
<service id="sylius.context.locale" class="%sylius.context.locale.class%">
<argument type="service" id="session" />
<argument>%sylius.locale%</argument>
</service>
<service id="sylius.locale_provider" class="%sylius.locale_provider.class%">
<argument type="service" id="sylius.repository.locale" />
</service>
<service id="sylius.event_listener.locale" class="%sylius.event_listener.locale.class%">
<argument type="service" id="sylius.context.locale" />
<tag name="kernel.event_subscriber" />
</service>
</services>
</container>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.templating.helper.locale.class">Sylius\Bundle\LocaleBundle\Templating\Helper\LocaleHelper</parameter>
</parameters>
<services>
<service id="sylius.templating.helper.locale" class="%sylius.templating.helper.locale.class%">
<argument type="service" id="sylius.context.locale" />
<tag name="templating.helper" alias="sylius_locale" />
</service>
</services>
</container>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.twig.extension.locale.class">Sylius\Bundle\LocaleBundle\Twig\LocaleExtension</parameter>
</parameters>
<services>
<service id="sylius.twig.extension.locale" class="%sylius.twig.extension.locale.class%" public="false">
<argument type="service" id="sylius.templating.helper.locale" />
<tag name="twig.extension" />
</service>
</services>
</container>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd">
<class name="Sylius\Component\Locale\Model\Locale">
<constraint name="Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity">
<option name="fields">code</option>
<option name="message">sylius.locale.code.unique</option>
<option name="groups">sylius</option>
</constraint>
<property name="code">
<constraint name="NotBlank">
<option name="message">sylius.locale.code.not_blank</option>
<option name="groups">sylius</option>
</constraint>
</property>
</class>
</constraint-mapping>

View file

@ -0,0 +1,19 @@
Copyright (c) 2011-2014 Paweł Jędrzejewski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Měna
rate: Kurz

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Valuta
rate: Afdrag

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Währung
rate: Kurs

View file

@ -0,0 +1,7 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Νόμισμα

View file

@ -0,0 +1,6 @@
sylius:
form:
currency:
code: Code
exchange_rate: Exchange rate
enabled: Enabled

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Moneda
rate: Tasa de cambio

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Devise
rate: Taux

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Valuta
rate: Tečaj

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Pénznem
rate: Árfolyam

View file

@ -0,0 +1,7 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Mata Uang

View file

@ -0,0 +1,7 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Valuta

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: 通貨
rate: 換算率

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Valuta
rate: Koers

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Valuta
rate: Sats

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Waluta
rate: Kurs

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Moeda
rate: Taxa

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Moneda
rate: Curs de schimb

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Валюта
rate: Курс

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Mena
rate: Kurz

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,8 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Valuta
rate: Stopa

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,7 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
form:
exchange_rate:
currency: Валюта

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Prosím zvolte měnu.
rate:
not_blank: Prosím zadejte sazbu.
unique: Měna musí být jedinečná.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Angiv valuta.
rate:
not_blank: Angiv afdrag.
unique: Valuta skal være unik.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Bitte wählen Sie eine Währung aus.
rate:
not_blank: Bitte geben Sie einen Kurs an.
unique: Die Währung muss einmalig sein.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Παρακαλούμε επιλέξτε νόμισμα.
rate:
not_blank: Παρακαλούμε εισάγετε ποσοστό.
unique: Το Νόμισμα πρέπει να είναι μοναδικό.

View file

@ -0,0 +1,7 @@
sylius:
currency:
code:
not_blank: Please choose currency code.
unique: Currency code must be unique.
exchange_rate:
not_blank: Please enter exchange rate.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Por favor seleccione una moneda.
rate:
not_blank: Por favor introduzca la tasa de cambio.
unique: La moneda debe ser única.

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Veuillez choisir une devise.
rate:
not_blank: Veuillez saisir un taux.
unique: La devise doit être unique.

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Odaberite valutu.
rate:
not_blank: Unesite trenutni devizni tečaj.
unique: Valuta mora biti jedinstvena.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Kérjük, válasszon valutanemet.
rate:
not_blank: Adja meg az árfolyamot.
unique: A valutanemnek egyedinek kell lennie.

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Si prega di scegliere la valuta.
rate:
not_blank: Inserisci il tasso.
unique: La valuta deve essere univoca.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: 通貨を選んでください。
rate:
not_blank: 換算率を入力してください。
unique: その通貨の組み合わせは既に登録されています。

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Kies uw valuta.
rate:
not_blank: Vul een ratio in.
unique: Valuta moet uniek zijn.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Velg valuta.
rate:
not_blank: Angi sats.
unique: Valuta må være unike.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Proszę wybrać walutę.
rate:
not_blank: Podaj kurs.
unique: Waluta musi być unikalna.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Por favor, escolha a moeda.
rate:
not_blank: Por favor, introduza a taxa.
unique: Moeda deve ser única.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Vă rugăm să alegeţi moneda.
rate:
not_blank: Vă rugăm să introduceți cursul de schimb.
unique: Moneda trebuie să fie unică.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Пожалуйста, выберите валюту.
rate:
not_blank: Пожалуйста, введите стоимость.
unique: Валюты должны быть уникальными.

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Prosím zvoľte menu.
rate:
not_blank: Prosím zadajte kurz.
unique: Mena musí byť unikátna.

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,10 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski
sylius:
exchange_rate:
currency:
not_blank: Molimo Vas izaberite valutu.
rate:
not_blank: Molimo Vas unesite stopu.
unique: Valuta mora biti jedinstvena.

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

View file

@ -0,0 +1,3 @@
# This file is part of the Sylius package.
# (c) Paweł Jędrzejewski

Some files were not shown because too many files have changed in this diff Show more