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
2ebc4768
Commit
2ebc4768
authored
Jun 16, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaked documentation
parent
38d505a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
doc/providers/translation.rst
doc/providers/translation.rst
+9
-11
No files found.
doc/providers/translation.rst
View file @
2ebc4768
...
...
@@ -128,20 +128,18 @@ use is ``locales/en.yml``. Just do the mapping in this file as follows:
hello: Hello %name%
goodbye: Goodbye %name%
Repeat this for all of your languages. Then add the files to the
``translator``::
$app['translator']->addResource('yaml', __DIR__.'/locales/en.yml', 'en');
$app['translator']->addResource('yaml', __DIR__.'/locales/de.yml', 'de');
$app['translator']->addResource('yaml', __DIR__.'/locales/fr.yml', 'fr');
Finally, register the ``YamlFileLoader`` on the translator::
Then, register the ``YamlFileLoader`` on the ``translator`` and add all your
translation files::
use Symfony\Component\Translation\Loader\YamlFileLoader;
$app['translator'] = $app->share($app->extend('translator', function($translator, $app) {
$translator->addLoader('yaml', return new YamlFileLoader());
$translator->addResource('yaml', __DIR__.'/locales/en.yml', 'en');
$translator->addResource('yaml', __DIR__.'/locales/de.yml', 'de');
$translator->addResource('yaml', __DIR__.'/locales/fr.yml', 'fr');
return $translator;
}));
...
...
@@ -154,9 +152,9 @@ Symfony2 ``Config`` component as a dependency (see above for details).
Then, similarly, create XLIFF files in your locales directory and add them to
the translator::
$
app['translator']
->addResource('xliff', __DIR__.'/locales/en.xlf', 'en');
$
app['translator']
->addResource('xliff', __DIR__.'/locales/de.xlf', 'de');
$
app['translator']
->addResource('xliff', __DIR__.'/locales/fr.xlf', 'fr');
$
translator
->addResource('xliff', __DIR__.'/locales/en.xlf', 'en');
$
translator
->addResource('xliff', __DIR__.'/locales/de.xlf', 'de');
$
translator
->addResource('xliff', __DIR__.'/locales/fr.xlf', 'fr');
.. note::
...
...
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