Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator text #36

Closed
pvankouteren opened this issue Nov 15, 2012 · 13 comments
Closed

Validator text #36

pvankouteren opened this issue Nov 15, 2012 · 13 comments
Assignees
Labels
bug A bug that has been verified
Milestone

Comments

@pvankouteren
Copy link
Contributor

When trying to register a (first) user 'Admin' with password 'admin', the password is too short (because of the minimum length of 6 characters). The error messages I get aren't nice:

snippet
8<---------------------------------

Password
This value is too short. It should have {{ limit }} characters or more.
This value is too short. It should have 6 characters or more.

Password (confirmation)
This value is too short. It should have {{ limit }} characters or more.

8<----------------------------------
end of snippet

@bobdenotter
Copy link
Member

I know, this is a weird one. I haven't been able to get it right, even though I think the code is how it should be. See also this pull-request, where we tried to fix it (unsuccessfully): https://github.com/bobdenotter/bolt/pull/22

@pvankouteren
Copy link
Contributor Author

Was looking into this one during lunch. Found these resources:

Also tried

$app['translator']->addLoader('xlf', new \Symfony\Component\Translation\Loader\XliffFileLoader());
$app['translator']->addResource('xlf', __DIR__ . '/../../../../vendor/symfony/validator/Symfony/Component/Validator/Resources/translations/validators.' . $app['locale'] . '.xlf', $app['locale'], 'validators');

Also unsuccessful. However, it looks like the validation translations aren't loaded or so..

@bobdenotter
Copy link
Member

This is an odd issue. I think it's a bug, but we can't be sure. If i can find some time, i'll try to set up a basic test case, so we can file a bug on the silex repo. (Unless you have other ideas, that is)

@pvankouteren
Copy link
Contributor Author

I'll give it another try, unless you already have your test case..?

@bobdenotter
Copy link
Member

No, I haven't spent any time on this yet.

@pvankouteren
Copy link
Contributor Author

I use the following fragment in my bootstrap of another Silex application:

$app->register(new Silex\Provider\FormServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
    'locale' => 'nl',
    'translator.messages' => array()
));
$app['translator']->addLoader('xlf', new Symfony\Component\Translation\Loader\XliffFileLoader());
$app['translator']->addResource('xlf', __DIR__ . '/../vendor/symfony/validator/Symfony/Component/Validator/Resources/translations/validators.nl.xlf', 'nl', 'validators');

It translates the validation messages in Dutch in that application.
When applying the same to Bolt, the translations are still in English.

All messages stay in English, no matter if I define $app['locale'] = 'nl' as well as the above fragment in the bootstrap as well as putting my browser to use the Dutch locale.

@bobdenotter
Copy link
Member

So, you're saying you don't know either why it's not working as it should? ;-)

I guess i'll just have to strip it down to a bare bones example, so we can either pinpoint where we did it wrong, or it might be a bug in silex.

@pvankouteren
Copy link
Contributor Author

Jup and the only thing that could be done is indeed strip it down and check by trial-and-error what is causing this to happen. I got some time to spend again, so I can try and start stripping it down (unless you have already started that is..?)

@bobdenotter
Copy link
Member

No, i haven't looked into it yet. I've been working on fleshing out
Taxonomies and Relationships, mostly.

On Thu, Jan 3, 2013 at 3:58 PM, Patrick van Kouteren <
notifications@github.com> wrote:

Jup and the only thing that could be done is indeed strip it down and
check by trial-and-error what is causing this to happen. I got some time to
spend again, so I can try and start stripping it down (unless you have
already started that is..?)


Reply to this email directly or view it on GitHubhttps://github.com/bobdenotter/bolt/issues/36#issuecomment-11846227.

Bob den Otter - bob@twokings.nl - 070-3457628 - www.twokings.nl

@pvankouteren
Copy link
Contributor Author

Okay, I have to check with the code where it works when I get home, but I got a bare setup which works. Unfortunately not in the Bolt-way just yet.

@pvankouteren
Copy link
Contributor Author

I got this one covered. Will look at issue #79 after I fixed this one. Looks kind of related.

@pvankouteren
Copy link
Contributor Author

Got this one fixed. However, there are multiple ways to do this each with their own elegance, so I'd like some input on the pull request :)

bobdenotter added a commit that referenced this issue Jan 10, 2013
@pvankouteren
Copy link
Contributor Author

Closed by the merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that has been verified
Projects
None yet
Development

No branches or pull requests

2 participants