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

Appearance settings

[Translation] Added Lokalise Provider #40927

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2021

Conversation

welcoMattic
Copy link
Member

@welcoMattic welcoMattic commented Apr 23, 2021

Q A
Branch? 5.x
Bug fix? no
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR symfony/symfony-docs#15310

To follow up on #38475, this PR adds Lokalise Provider.

The todo list to make it ready is:

  • Apply recent changes that have been made on ProviderInterface and TranslatorBagInterface (we removed the all() and getDomains() method from TranslatorBagInterface)
  • Add LokaliseProvider to src/Symfony/Bundle/FrameworkBundle/Resources/config/translation_providers.php file
  • Add Lokalise case to Symfony\Component\Translation\Exception\UnsupportedSchemeException
  • Move LokaliseProvider and LokaliseProviderFactory from Symfony\Component\Translation\Bridge\Lokalise\Provider to Symfony\Component\Translation\Bridge\Lokalise namespace
  • Write integration tests by mocking HTTP Responses

The major part of the remaining work concerns tests, I will make it done before the beginning of May.

@carsonbot
Copy link

Please note that you need squash your commits before this PR can be merged. The maintainer can also squash the commits for you, but then you need to “Allow edits from maintainer” (there is a checkbox in the sidebar of the PR).

Cheers!

Carsonbot

Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

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

Do you need to adjust UnsupoortedSchemeException like we do for the Notifier?

OskarStark added a commit that referenced this pull request Apr 27, 2021
…etter (Nyholm)

This PR was merged into the 5.3-dev branch.

Discussion
----------

[CI] Sort packages by length to match modified package better

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Given the build error in #40927, I saw that we match "modified packages" wrong. The script things we modified `symfony/translation` rather than the new bridge. This is because we are using a simple [string matchning](https://github.com/symfony/symfony/blob/18658a29a37d6de3e73c95f96fb9e51bf1d5f59d/.github/get-modified-packages.php#L24). If we sort the packages by length, we make sure we match the most detailed (longest) string first.

Commits
-------

f7a0bd1 [CI] Sort packages by length to match modified package better
@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch 2 times, most recently from c41ea84 to 749cca8 Compare April 27, 2021 16:23
@welcoMattic
Copy link
Member Author

Thanks @OskarStark for the quick review, I have not finish the revamp of Lokalise accordingly to the recent changes 😉

@welcoMattic
Copy link
Member Author

welcoMattic commented May 5, 2021

status: needs review

CI failures seems unrelated to this PR.

@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch 3 times, most recently from 906af69 to d7a0ad9 Compare May 5, 2021 13:08
@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch 2 times, most recently from d434655 to 2399fc7 Compare May 5, 2021 13:18
@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch from 2399fc7 to 608685f Compare May 6, 2021 20:39
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

(with easy to fix comments)

@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch 3 times, most recently from 4fef59d to 31df459 Compare May 7, 2021 16:35
@fabpot
Copy link
Member

fabpot commented May 9, 2021

Tests seem broken.

@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch from 15b6ba2 to 6a5d222 Compare May 9, 2021 16:02
@welcoMattic
Copy link
Member Author

@fabpot I've just pushed a fix (adding symfony/config as dev dependency of the Lokalise Provider Bridge). It fixes tests on Travis. On AppVeyor, failures seems unrelated

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

LGTM, to be merged after the HOST constant is fixed.

@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch 2 times, most recently from ebd9708 to fe0685a Compare May 10, 2021 09:58
@welcoMattic
Copy link
Member Author

welcoMattic commented May 10, 2021

@fabpot Last comment has been addressed, branch has been rebased, it looks ready 👍

@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch 2 times, most recently from 631b635 to 82179a6 Compare May 10, 2021 10:05
@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch 2 times, most recently from 3b068e8 to 89f9e1d Compare May 10, 2021 10:07
@welcoMattic welcoMattic force-pushed the feature/lokalise-provider branch from 89f9e1d to 022d828 Compare May 10, 2021 10:15
@fabpot
Copy link
Member

fabpot commented May 10, 2021

Thank you @welcoMattic.

@fabpot fabpot merged commit 0b66008 into symfony:5.x May 10, 2021
@stof
Copy link
Member

stof commented May 10, 2021

@welcoMattic actually, the symfony/config component is necessary when using the xliff loader (which is why it is only a dev dependency in symfony/translation as you are not forced to use xliff). As the Lokalise provider relies on loading xliff, it should have a non-dev requirement on symfony/config

@stof
Copy link
Member

stof commented May 10, 2021

@welcoMattic does this provider handle properly the fact that Symfony translation keys are only unique inside a domain, not globally ?

@welcoMattic welcoMattic deleted the feature/lokalise-provider branch May 10, 2021 11:51
@welcoMattic
Copy link
Member Author

@stof indeed, actually all Translation Providers use XliffFileLoader for loading pulled translations, so I guess I should set symfony/config as hard dependency in Loco, Lokalise, PoEditor and Crowdin Providers?

About handling translation keys by domain and not glabally, I paid attention to handle it in all Providers after your first comment about it.

@stof
Copy link
Member

stof commented May 10, 2021

so I guess I should set symfony/config as hard dependency in Loco, Lokalise, PoEditor and Crowdin Providers?

yes, indeed.

@welcoMattic
Copy link
Member Author

@stof fixed here #41155

fabpot added a commit that referenced this pull request May 10, 2021
This PR was merged into the 5.3-dev branch.

Discussion
----------

[Translation] Improved Translation Providers

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Some small improvements on Translation Providers:
- move symfony/config from dev dependency to hard dependency for all Bridges as all providers use XliffFileLoader to load pulled translations (cf. #40927 (comment))
- replace all instances of
```
'headers' => [
    'Authorization' => 'Bearer API_TOKEN',
]
```
with `'auth_bearer' => 'API_TOKEN',` even in tests files.
- Fix Lokalise base_uri concatenation

Commits
-------

84fd13c Improved Translation Providers
@fabpot fabpot mentioned this pull request May 12, 2021
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request May 19, 2021
This PR was submitted for the 5.4 branch but it was squashed and merged into the 5.3 branch instead.

Discussion
----------

[Translation] Introduce Translation Providers

Docs for symfony/symfony#38475, symfony/symfony#40926, symfony/symfony#40927, and symfony/symfony#40947

Ready for first review, but I'm not sure that I've written documentation in the right and all required places.

ATM, Translation Providers Bridges packages doesn't exists, so Flex recipes are not created yet.

Commits
-------

943a63f [Translation] Introduce Translation Providers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.