webmozart / standalone-forms

139 stars 30 forks source link

Translation doesn't work in version >2.1 #7

Closed nadrshin closed 9 years ago

nadrshin commented 10 years ago

code: $translator = new Translator('ru'); $translator->addLoader('xlf', new XliffFileLoader()); $translator->addResource('xlf', VENDOR_FORM_DIR . '/Resources/translations/validators.ru.xlf', 'ru', 'validators'); $translator->addResource('xlf', VENDOR_VALIDATOR_DIR . '/Resources/translations/validators.ru.xlf', 'ru', 'validators');

version 2.1: result: OK

version >2.1: result: FAIL

What to do?

berny46 commented 9 years ago

I'm on Symfony 2.6, having the same problem. I figured out, that in this part (I'm using twig), the last three lines don't have any effect. You can just leave them away.

// Set up the Translation component
$translator = new Translator('en');
$translator->addLoader('xlf', new XliffFileLoader());
$translator->addResource('xlf', VENDOR_FORM_DIR . '/Resources/translations/validators.en.xlf', 'en', 'validators');
$translator->addResource('xlf', VENDOR_VALIDATOR_DIR . '/Resources/translations/validators.en.xlf', 'en', 'validators');

Any help would be appreciated. Thanks, Chris

ldath commented 9 years ago

Now this example is upgraded to 2.7 of the Symfony Forms library. This problem is solved.

webmozart commented 9 years ago

Thanks @ldath :) I guess this can be closed now.