You are browsing the documentation for version 4.2 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Data Fixtures for Translation Entities

Article provides information about data fixtures for translatable entities.

Classes Description


This class is intended for creating of translatable entities. It gathers translation files, defines existing locales and provides service methods to perform translation.

Descended classes must define method “loadEntities”.


  • ENTITY_DOMAIN - translation domain that contains translations for translatable entities, default value is “entities”;

  • DOMAIN_FILE_REGEXP - regular expression for matching of appropriate translation files and extracting of locale.


  • load - method from Doctrine AbstractFixture, entry point for data fixture run, sets translator property and runs loadEntities method;

  • setContainer - method form ContainerAwareInterface, sets container property;

  • loadEntities - abstract method, must be specified in descendant classes to load entities;

  • getDomainFileRegExp - returns formed regular expression based on source expression and current domain;

  • getTranslationLocales - parses all translation files and searches files that matches formed regular expression, returns list of locales with appropriate translations;

  • translate - translates string for specified ID, prefix and locale;

Parameters and domain also can be specified manually;

  • getTranslationId - forms translation ID based on entity string ID and entity prefix.