0

I work on a multilingual web application with ZF2 (2.2.6).

I've installed php5-intl and enabled it in the php.ini

I've add this on my module config :

array(
    'type'        => 'phparray',
    'base_dir'    =>  'vendor/zendframework/zendframework/resources/languages',
    'pattern'     => '/fr/Zend_Validate.php',
    'text_domain' => 'default'
    )

The translation work on simple message like "Value is required and can't be empty" but don't work if the text contains parameters like "The input is less than 3 characters long".

Charles
  • 50,943
  • 13
  • 104
  • 142
Jerob
  • 1
  • 2

1 Answers1

0

You have to translate the exact string as it is written in the validator itself. The 3 is substituted. If you look at the source code, you see there's another string.

TL;DR: translate The input is less than %min% characters long

Jurian Sluiman
  • 13,498
  • 3
  • 67
  • 99
  • Thank you, but i don't need to translate the text by myself. I just want to use the resources Zend_Validate.php, which contain pre-translated string. – Jerob Mar 07 '14 at 16:55
  • Oh damn, missed that part completely. Not sure then. as I never use the provided resource files :) – Jurian Sluiman Mar 07 '14 at 16:56
  • @Badbugs you can debug yourself by checking variables inside the AbstractValidator class. Check error(), createMessage() and translateMessage(). Perhaps there's some issue in translating messages with variables from the resource file? – Jurian Sluiman Mar 07 '14 at 17:02