Search code examples
phpzend-frameworkzend-validatezend-translate

Recommended place for pre-translated Zend Framework resources


Since zf 1.10 Zend Framework ships with pre-translated validation messages. They are outside the library path.

The manual illustrates how to load these in your bootstrap.

$translator = new Zend_Translate(
    'array',
    '/resources/languages',
    $language,
    array('scan' => Zend_Locale::LOCALE_DIRECTORY)
);

Zend_Validate_Abstract::setDefaultTranslator($translator);

I am inclined to think that these resources are specific to the zf-version; validators could change over time. If i copy the resources to my application tree I need to perform additional maintenance each time I upgrade to a newer version.

What is best practice? Is there a ZF convention already?


Solution

  • Those translation are provided for your convenience, it is not really a supported feature.

    Most of the time, you don't want to overwrite translation file with unknown, if Zend decides to change some translations, you may not want to follow them.

    Then, you need to manually check what's changed from the previous release, to be sure to don't break the wording of your application.

    I don't really get the point.

    However if you really don't to have to cp -R (and I understand), you can use svn:external to load such resources, and update consequently.

    With git (which I use), it can be a little more tricky, but you can success with git-subtree