2

My translated website version of symfony 2.2 was right till I have upgraded to v.2.3.2.

I have all my translated files in yml format. And seems to be good.

I have seen that in the new version, Symfony use its own Intl, right? But why it doesn't want to translate my pages?

1/1 InvalidArgumentException: Only the locale "en" is supported.

for information i have these values into my php info:

intl

Internationalization support    enabled
version 1.1.0
ICU version 4.8.1.1
ICU Data version    4.8.1

Directive   Local Value Master Value
intl.default_locale no value    no value
intl.error_level    0   0

EDIT:

It seems that the problem comes from the CountryType. If I force the locale to english it works.

Sam
  • 779
  • 3
  • 18
  • 39
  • Is it the same issue than here: http://stackoverflow.com/questions/17783871/symfony-2-2-symfony-2-3-error-deutsch-locale ? If yes, please don't post 2 questions for the same issue. – cheesemacfly Jul 22 '13 at 14:29
  • No it is not the same. This one don't allow me to translate any page, the other one, seems to be an error from deutch language... – Sam Jul 22 '13 at 14:37

3 Answers3

1

I solved this problem by installing the symfony intl component.

Try to add this line to your composer.json :

"symfony/intl": "2.6.*@dev"
Ousmane
  • 2,673
  • 3
  • 30
  • 37
1

I debug the error and it brings me finally to

vendor/symfony/symfony/src/Symfony/Component/Translation/Translator.php

In the variable $locale on line 420 stands "de " (in my case). The empty space is the problem. If you put $locale = trim($locale); before the regular expression it works.

Dmitriy
  • 5,525
  • 12
  • 25
  • 38
T-Rex
  • 25
  • 2
0

It seems to fail for the dates formatage. It uses the IntlDateFormatter which is only compatible with "en" date format.

Can you disable the translation for the dates from a page and see if it's works ?

Otherwise comment this part of the source code of Symfony :

if ('en' != $locale) {
            throw new MethodArgumentValueNotImplementedException(__METHOD__, 'locale', $locale, 'Only the locale "en" is supported');
        }
jody_lognoul
  • 817
  • 7
  • 15
  • It doesn't work if I comment this part. I have to comment all this kind of messages and I have an error as: `The resource bundle "vendor/symfony/icu/Symfony/Component/Icu/Resources/data/region/fr.php" does not exist`. I hope this is not the only way.. – Sam Jul 22 '13 at 14:58
  • Are you sure that you were in 2.2 ? Not in 2.1 ? – jody_lognoul Jul 22 '13 at 15:12
  • It seems that the problem come from Country – Sam Jul 22 '13 at 15:20
  • http://symfony.com/doc/current/book/translation.html Doesnt seem that there was a difference between 2.2 and 2.3 for the i18n :O – jody_lognoul Jul 22 '13 at 15:24
  • From the Country ? Why do you think of that ? – jody_lognoul Jul 22 '13 at 15:24
  • because when I comment all the exception into Intl*Formatter the errors occurs saying me that `at AbstractBundle->readEntry('fr', array('Countries')) in vendor/symfony/symfony/src/Symfony/Component/Intl/ResourceBundle/RegionBundle.php line 42` – Sam Jul 22 '13 at 15:30
  • If it's using `Symfony/intl` it seems that the intl extension isn't configured correctly: https://github.com/symfony/Intl/blob/master/README.md Have you checked that the extension is really available for the webserver and not only on CLI? – althaus Jul 23 '13 at 08:06
  • how can I check if it is available on webserver? – Sam Jul 23 '13 at 10:19