Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Translation][FrameworkBundle] Adding Translation Providers#37462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@welcoMattic
Copy link
Member

@welcoMatticwelcoMattic commentedJun 30, 2020
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#36543
LicenseMIT
Doc PRtodo

This PR refers to the early opened RFC#36543 about adding third party translation SaaS into Symfony.
I worked in collaboration with@odolbeau on this first draft.

We have implemented only Loco Provider for now, to validate the main workflow of the feature.
We are not very sure about some naming convention, such asRemote StorageProvider, it might be renamed in Transport, to correspond to the naming of third party services in Mailer and Notifier Components.

This PR brings 2 new commands in FrameworkBundle:translation:push andtranslation:pull
It adds also new configuration entry:

framework:default_locale:frtranslator:default_path:'%kernel.project_dir%/translations'enabled_locales:'%locales%'fallbacks:            -en            -itproviders:loco:dsn:'%env(LOCO_DSN)%'domains:['messages']locales:'%locales%'

To do

  • ImplementRemote StoragesProvider into Translation component
  • Plug it into FrameworkBundle
  • Implement pull and push commands
  • Implement Loco adapter
  • Implement Transifex Provider (:warning: API key could contains special characters like /, +, :, @, #, %, etc..., we must mention it in documentation and warn users to encode those special characters before paste them in .env)
  • Implement POEditor Provider (:warning: there is a trick to do in POEditor Dashboard in order to make XLF export works, it will have to be documented explicitly in the symfony/symfony-docs PR)
  • Implement Crowdin Provider (:pause_button: stand by, the API is more complex to use than other Translation Management Systems)
  • Tests
  • Documentation
  • Update CHANGELOG.md files in FrameworkBundle and Translation Component

Transifex Provider

To do:

  • Ensure that the creation of a Resource per translation key is the right way to do, if not re-work this part
  • Implement API call for Translation creation
  • Implement API call for Resource (means translation key) deletion

Crowdin Provider

To do:

  • Implement Add Storage and Add File API calls in order to create translations keys in Crowdin from the default locale local file
  • Implement Add Translation API call to send translation messages
  • Implement Update File API call in order to add or delete a translation key from a File

YaFou, damienalexandre, noahlvb, lyrixx, andrii-bodnar, and dies reacted with thumbs up emojiYaFou, noahlvb, stephane-lou, lyrixx, andrii-bodnar, and dies reacted with heart emoji
@welcoMatticwelcoMattic changed the titleFeature/remote storages[Translation][FrameworkBundle] Adding translation remote storagesJun 30, 2020
@nicolas-grekasnicolas-grekas added this to thenext milestoneJun 30, 2020
@YaFou
Copy link
Contributor

YaFou commentedJul 1, 2020
edited
Loading

I'm really interested in this new feature! Thank you, it's promising! 👏 I also have another adapter that can be implemented:Crowdin.

welcoMattic reacted with thumbs up emoji

@welcoMatticwelcoMatticforce-pushed thefeature/remote-storages branch from326c05e tode0138fCompareJuly 1, 2020 08:52
@welcoMatticwelcoMatticforce-pushed thefeature/remote-storages branch 2 times, most recently from5beef58 tob9f5792CompareJuly 1, 2020 13:05
@welcoMatticwelcoMattic marked this pull request as ready for reviewAugust 7, 2020 10:14
@welcoMatticwelcoMatticforce-pushed thefeature/remote-storages branch 3 times, most recently from43a9251 to9a230fdCompareAugust 7, 2020 14:12
@YaFou
Copy link
Contributor

@welcoMattic for the Transifex bridge, have you try to use%2F to escape/ for the token?

welcoMattic reacted with thumbs up emoji

@welcoMattic
Copy link
MemberAuthor

Before continuing the work on this PR, I ask myself several questions:

  • Should we rename RemoteStorage to Transport? (like in Notifier, Mailer, ...)
  • How many built-in SaaS client should we support for this first PR (should we release other "Transports" later in separate packages as it's done in Notifier?)
  • Should we simplify the AbstractFactory part? (after all I think is very complex for no obvious reason)

Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've just done a very very quick review to better understand the PR and its goals.


useSymfony\Component\Translation\TranslatorBag;

class RemoteDecoratorimplements RemoteInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why is it useful?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It is in theread method, that we merge wanted domains (passed as arguments in commands) with default domains (defined in configuration)

@fabpot
Copy link
Member

I think we would need at least 2 (or 3) providers to exercise the API and be sure it's generic and powerful enough.
I like the feature and I'd love to add it to 5.2 if possible.

welcoMattic reacted with thumbs up emoji

@welcoMattic
Copy link
MemberAuthor

Thank you for the review. I'm ok to add 2 or 3 Providers (I will rename RemoteStorage for Provider).
I hope too include this feature in 5.2 release, I will do my best to work regularly on it, in order to be ready for 5.2.

@welcoMattic
Copy link
MemberAuthor

@andrii-bodnar Hi, sorry but I do not understand how Crowdin API works for uploading translations. You mentioned theUpload Translations endpoint, but in the documentation, there is no mention of content uploading. How do I upload existing translations and in which format?

@andrii-bodnar
Copy link
Contributor

Hi@welcoMattic,

let's imagine you have domainadmin.en.xlf and French translations -admin.fr.xlf

Fileadmin.en.xlf is being added to the Crowdin project.

Now, if you want to uploadadmin.fr.xlf translations to Crowdin, you need to create a Storage with this file and useUpload Translations method. This method acceptsstorageId (admin.fr.xlf) andfileId (admin.en.xlf file ID)

@welcoMattic
Copy link
MemberAuthor

@andrii-bodnar thank you for the quick answer. Ok, it's not very easy to understand the concepts of Storage and File, moreover with an Upload operation between them. But ok, I will try to implement this workflow in Symfony. Thanks again.

andrii-bodnar reacted with thumbs up emoji

@welcoMattic
Copy link
MemberAuthor

@andrii-bodnar can we discuss by email or inSymfony Slack? I still have difficulties to send existing translations to Crowdin.

@andrii-bodnar
Copy link
Contributor

@welcoMattic, sure, I'll try to join Symfony Slack.

@stephane-lou
Copy link

This is a very welcome feature, thanks for the work guys !

welcoMattic reacted with thumbs up emoji

@welcoMattic
Copy link
MemberAuthor

Well, there's still a lot of work here before we get to a complete and stable functionality (especially for the Provider Crowdin), and then the functional tests are not written yet.

For Crowdin, we have been working the last few days with@andrii-bodnar in order to implement all needed API calls, and it remains thedelete method to implement, but Crowdin API does not allow fine deletion for translations keys. It's planned on their side to introduce such an endpoint very soon.

For Transifex, I need to work again the Provider, and explore the API more deeply to find the right way to do things.

For all these reasons, I think we should target a merge for 5.3, it's more reasonable than speed up work and merge an unstable feature in 5.2.

@fabpotfabpot closed thisOct 7, 2020
@fabpot
Copy link
Member

We've just moved away frommaster as the main branch to use5.x instead. Unfortunately, I cannot reopen the PR and change the target branch to5.x. Can you open a new PR referencing this one to not loose the discussion? Thank you for your understanding and for your help.

welcoMattic reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas modified the milestones:5.x,5.2Oct 14, 2020
fabpot added a commit that referenced this pull requestApr 21, 2021
This PR was merged into the 5.3-dev branch.Discussion----------[Translation] Adding Translation Providers| Q             | A| ------------- | ---| Branch?       | 5.x| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       |Fix#36543| License       | MIT| Doc PR        | todo> Follow up of#37462This PR refers to the early opened RFC#36543 about adding third party translation SaaS into Symfony.I worked in collaboration with `@odolbeau` on this first draft.We have implemented only Loco Provider for now, to validate the main workflow of the feature.~~We are not very sure about some naming convention, such as Remote Storage, it might be renamed in Transport, to correspond to the naming of third party services in Mailer and Notifier Components.~~ We use Provider name.This PR brings 2 new commands in Translation component: `translation:push` and `translation:pull`It adds also new configuration entry:```yamlframework:    default_locale: fr    translator:        default_path: '%kernel.project_dir%/translations'        enabled_locales: '%locales%'        fallbacks:            - en            - it        providers:            loco:                dsn: '%env(LOCO_DSN)%'                domains: ['messages']                locales: '%locales%'```## To do- [x] Implement Provider into Translation component- [x] Plug it into FrameworkBundle- [x] Implement pull and push commands- [x] Implement Loco adapter- [x] Tests- [ ] Documentation- [x] Update CHANGELOG.md files in FrameworkBundle and Translation ComponentDocs:Adapt language settings in Lokalise to be sure that Symfony locales match with Lokalise languages![language-setting-lokalise](https://user-images.githubusercontent.com/773875/102089496-997c5200-3e1c-11eb-8bff-bd2f9a5fe100.png)Todo:- [x] Implement POEditor Provider (:warning: there is a trick to do in POEditor Dashboard in order to make XLF export works, it will have to be documented explicitly in the symfony/symfony-docs PR)- [x] Implement Lokalise Provider- [x] Implement Crowdin ProviderThese 3 providers are implemented separately. They are not fully tested yet, it is planned to make it done by the end of April 2021.Commits-------6e55fa8 Added Translation Providers
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot requested changes

+2 more reviewers

@PierstovalPierstovalPierstoval left review comments

@TaluuTaluuTaluu approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

[RFC] [Translation] Remote Storages

11 participants

@welcoMattic@YaFou@fabpot@andrii-bodnar@stof@stephane-lou@Taluu@Pierstoval@nicolas-grekas@yceruto@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp