OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – How do I? Questions How to give priority to read translation msgs from config files rather than DB

This topic contains 1 reply, has 2 voices, and was last updated by  Przemek Nogaj 5 years ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #29391


    Hi Team,
    i have a situation wherein i have to give a different label for a default message key which is present in oro_translation_key table mapped with oro_translation table. Now my issue is how to change the value for the given message key(ex : oro.organization.businessunit.owner.label) present in table from default value with another value without changing it in Database by updating table row.
    When i try using the same domain structure(i.e oro.organization.businessunit.owner.label) in a config file (ex: messages.fr_FR.yml ) and clearing the cache, it does not read from config file but reads from Database. Now if i change the key value from translation_key table to something else (ex: From oro.organization.businessunit.owner.label to oro.organization.businessunit.owner1.label) & then cache clear . Then Translation would take value from the messages.fr_FR.yml where i had defined the same key (oro.organization.businessunit.owner.label) as it was not able to find the matching key in Database.

    So is there a way wherein we can give priority to check translation labels for all messages through messages.{lang}.yml configuration file & fetch the translation value , if not found in any of those message.{lang}.yml config file then to check in Database.

    The reason why i am concerned with this approach is ,later even if the DB is changed to a new DB just by configuration files i will be able to retain translations rather than maintaining a track of some update queries and running it each time i change application to connect a new DB .

    I tried to look at translation Bundle present in Oro under Vendor Directory & also Symfony Translation code but could not get much clarity on how to go about with changing the priority. i could see that a catalog is used which helps in maintaining a cache file which contains all those messages for use by application.

    Please help if possible on how to change the priority from Database to the configuration files.

    Application related Info:

    Application Version: 2.3 (latest)
    Application Type : OroCRM , OroPlatform

    Environment Used:
    Os : Cent Os 7.1
    Database: Mysql 5.7
    Php: Version 7.1

    Thanks & Regards,
    Shreyas S

Viewing 1 replies (of 1 total)
  • Author
  • #29392

    Przemek Nogaj

    Hello shreyas,

    to achieve your goal you need to create a new bundle with custom translations. To force platform to use your translations, you simply have to load this bundle at the end, after other translations for that domain. You can do it using priority option in bundles.yml

    Minimal bundle structure (an example of changing Contact label in Opportunity grid):




Viewing 1 replies (of 1 total)

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

Back to top

You will be redirected to [title]. Would you like to continue?

Yes No

You will be redirected to [title]. Would you like to continue?

Yes No