I am new to Symfony2. Trying to establish translation Service. I am following
the steps given in the official documentation. But not successful.
Following are steps followed
In 'symfony/app/config/config.yml' translation service activated by
defining locale variable as "#translator:{ fallback: %locale% }"
In 'symfony/app/config/parameters.yml' defined locale parameter as
"locale:de"
In 'src/MyBundle/translateBundle/Resources/translations/messages.de.xlf' is
created
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>Symfony2 is great</source>
<target>J'aime Symfony2</target>
</trans-unit>
</body>
</file>
</xliff>
Now I hope with this coding now I should get: 'J'aime Symfony2' on
execution of following code.
<?php
namespace MyDays\translateBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
class DefaultController extends Controller {
public function indexAction() {
$t = $this->get ( 'translator' )->trans ( 'Symfony2 is great' );
return new Response ( $t );
}
}
But still getting original text as 'Symfony2 is great'
Is there anything I have to do apart from the steps given in documentation.
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en