OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions Crowdin – integrate translations from another project

This topic contains 8 replies, has 3 voices, and was last updated by  jakabadambalazs 9 years ago.

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

  • Creator
    Topic
  • #35927

    jakabadambalazs
    Participant

    Hi,

    I am working on a custom application, called MekitCrm, built on top of the OroPlatform. I have created the project on Crowdin, I have uploaded all files for translations and I have translated them to Italian.

    Now, I’d like to integrate it with the platform so that when I download the translations from UI it downloads the requested language for both (OroPlatform and MekitCrm) projects.

    Is there an easy way to do this or do I have to extend the platform’s TranslationBundle do achieve this?

    a\


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #35928

    ishakuta
    Participant

    Hi, @jakabadambalazs

    Generally it’s simple, but I think you’ll have to override:
    – ServiceController in TranslationBundle, in order to pass your adapter to TranslationServiceProvider
    OR
    – change oro_translation.oro_translation_adapter service to your own and implement download action that will download translations from both Crowdin projects. You can extend/re-use CrowdinAdapter (AbstractAPIAdapter) for that.

    Now, the main reason why you need custom adapter is that you have to download translation packs from two Crowdin projects (Oro’s and your own), but CrowdinAdapter supports downloads only from one.

    Also you may have to override TranslationServiceProvider::download method, cause it assumes that download adapter saved only one zip archive, or your custom adapter should prepare single zip archive after download from two Crowdin projects.

    Alternatively you may implement kind-of a proxy that will take list of projects, download them and re-package them for OroPlatform application, as we did for our out-of-the-box instance, you may see it’s default URL in Oro\Bundle\TranslationBundle\DependencyInjection\Configuration and can change it in app/config.yml

    Let us know if you’ll have any further questions.

    #35929

    jakabadambalazs
    Participant

    Hi @ishakuta,

    Thanks a lot! It seems fun!

    Yes, I’have already looked into the DI config file and I noticed that you are not downloading the translations directly from Crowdin.

    Is this because of the repackaging thing (I immagine you package together OroPlatform and OroCrm) or is it because this way the project API key is not disclosed?

    As far as I understand even for downloading the translations one needs to provide the API key. This would mean to package the API key with the project itself – which obviously does not seem to be a great idea.

    is this correct?

    So, maybe the proxy thing is the only way to go about this – what do you think?
    a\


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #35930

    ishakuta
    Participant

    Yes, I think you’re right.

    It’s because of both problems:
    – API key disclosure, cause of Crowdin API
    – repackage for multiple projects (can be done in your code)

    #35931

    jakabadambalazs
    Participant

    ok, thanks! I’ll give it a go!


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #35932

    jakabadambalazs
    Participant

    Hi @ishakuta,

    I have a related question – once I have all in place and working – one day I’d like to be able to execute the oro:install command with some flag and install the entire application in a specific language – or better install it in english as it is but also download and activate a specific language right away.

    This is not possible at the moment, am I correct?
    And there is no console command either to do this?

    Do you think this would be useful to make a console command to do this (maybe a “oro:translation:install”) – maybe i could make a PR for this

    …have you got any plans in the near future to implement per-user language settings – that is: each user can use the application in his/her preferred language?

    thanks
    a\


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

    #35933

    ishakuta
    Participant

    Hi,
    yes, it’s not possible right now

    I think the way it should work, in scope of user-related settings, is some-kind of parameter for oro:install command, like existing –user-email or –application-url, something like –user-lang or –user-locale.

    #35934

    Dima Soroka
    Keymaster

    As an option you could bundle available languages into your application distribution.

    #35935

    jakabadambalazs
    Participant

    Yes, this is what I have been doing up until now but it is a temporary solution and very difficult to maintain. I think I’ll go with the proxy server solution.


    oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)

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

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

Back to top