Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
8e7c0a4b
Commit
8e7c0a4b
authored
Feb 22, 2012
by
Sasa Stamenkovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applied fixes requested by igorw.
parent
d7df7eb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
doc/cookbook/translating_validation_messages.rst
doc/cookbook/translating_validation_messages.rst
+5
-3
No files found.
doc/cookbook/translating_validation_messages.rst
View file @
8e7c0a4b
Translating Validation Messages
===============================
When working with Symfony2
forms
, a common task would be to show localized validation messages.
When working with Symfony2
validator
, a common task would be to show localized validation messages.
In order to do that, you will need to register translator and point to translated resources:
...
...
@@ -12,7 +12,9 @@ In order to do that, you will need to register translator and point to translate
'translation.class_path' => __DIR__ . '/vendor/symfony/src',
'translator.messages' => array()
));
$app['translator']->addLoader('xlf', new Symfony\Component\Translation\Loader\XliffFileLoader());
$app['translator']->addResource('xlf', __DIR__ . '/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/translations/validators.sr_Latn.xlf', 'sr_Latn', 'validators');
$app->before(function () use ($app) {
$app['translator']->addLoader('xlf', new Symfony\Component\Translation\Loader\XliffFileLoader());
$app['translator']->addResource('xlf', __DIR__ . '/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/translations/validators.sr_Latn.xlf', 'sr_Latn', 'validators');
});
And that's all you need to load translations from Symfony2 ``xlf`` files.
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment