ongr-io / TranslationsBundle

Translations GUI for translating Symfony static strings
MIT License
5 stars 13 forks source link

Support short name of bundles in import command. #73

Closed ndinh215 closed 8 years ago

ndinh215 commented 8 years ago

I implemented the issue #64 . Please review it. Thanks.

ndinh215 commented 8 years ago

Some hardcode made this bundle not able to run both with Symfony 2 and 3. For example:

$classes = [
'Symfony\Component\Validator\Validator' => '/Resources/translations',
'Symfony\Component\Form\Form' => '/Resources/translations',
'Symfony\Component\Security\Core\Exception\AuthenticationException' => '/../../Resources/translations',
];

It needs to be refactored. I will wait for your decision, @saimaz . Thanks.

ndinh215 commented 8 years ago

I fixed it, please check. Thanks.

saimaz commented 8 years ago

Sorry, I've missed that we are checking namespace. It's already checked by Symfony, no need to check it twice. Actually, we don't need validateBundle function. Just request it from the kernel, if bundle won't exist kernel will throw an exception.

ndinh215 commented 8 years ago

@saimaz , you are correct. Without a bundle existence, it will throw the exception:

Bundle "bundle name" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your AppKernel.php file?

Thanks.

ndinh215 commented 8 years ago

I removed it. Please check. Thanks.