ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 0 replies, has 1 voice, and was last updated by  shreyas 1 week, 5 days ago.

  • Creator
    Topic
  • #39070

    shreyas
    Participant

    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
    Replies
  • #39083

    Przemek Nogaj
    Participant

    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):

    Acme/Bundle/TranslationsBundle/Resources/config/oro/bundles.yml:

    Acme/Bundle/TranslationsBundle/Resources/config/translations/messages.en.yml:

    Acme/Bundle/TranslationsBundle/AcmeTranslationsBundle.php:

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.