OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform Overwrite translation

This topic contains 7 replies, has 2 voices, and was last updated by  William Radi 5 years, 11 months ago.

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

  • Creator
    Topic
  • #37141

    William Radi
    Participant

    Hello there!

    I installed the portuguese language (pt_BR ) in my CRM, however there are some expressions (that are in portuguese) that should be changed.

    Is there a way to programmatically overwrite the downloaded translation?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #37142

    William Radi
    Participant

    Is it possible to do?

    #37143

    Andrey Yatsenko
    Moderator

    Hi Willam,
    translations are already loaded to the database and you can edit it from UI, it will be easy
    see this link https://oroinc.com/orocrm/doc/current/admin-guide/localization/translations

    And from the code side you can load them from the yml files as usual to symfony, from the files like “messages.pt_BR.yml” placed at Resources/translation folder. Where “messages” is the translation domain. the original domain and message you can find at the UI just by searching at the translation grid.

    Just don’t forget to run “app/console oro:translation:load” command after you updated it at the code to load new translation to the database.

    #37144

    William Radi
    Participant

    Hi Anyt! Thanks again! :)
    And, sorry for the delay too..

    So… Using the UI, I can translate.. But from the code side, I found the exatly key that I wanted to translate and added to my messages.pt_BR.yml, but didn’t work =/

    I guess I couldn’t made sth wrong because I found the key in the documentation and I could translate english things near of the portuguese text that I want to change.

    Any idea? :D
    Thaks so much!

    #37145

    Andrey Yatsenko
    Moderator

    Did you run app/console oro:translation:load command after changing messages at the code?

    #37146

    William Radi
    Participant

    Tried it again here.. But unsuccesful…

    #37147

    Andrey Yatsenko
    Moderator

    Hi William,

    Downloaded translations have higher priority than yml files, so the command didn’t help.
    You can override them now only using data fixtures from code.

    For that purpose use Oro\Bundle\TranslationBundle\Manager\TranslationManager::saveTranslation() method with Translation::SCOPE_UI as the last argument.

    Here is an example of how this migration will look like

    After adding migration you need to run app/console oro:migration:data:load --env=prod --bundles=AppBundle where AppBundle should be replaced with your bundle name.

    Migrations also can be loaded with app/console oro:platform:update but it will take more time as there a lot of other actions executed

    #37148

    William Radi
    Participant

    Thanks a lot, man!

    I just changed the namespace, translation keys and values, executed:

    And works! o/

Viewing 7 replies - 1 through 7 (of 7 total)

The forum ‘OroPlatform’ is closed to new topics and replies.

Back to top