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] [Bridge][Lokalise] Fix empty keys array in PUT, DELETE requests causing Lokalise API error#58983

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

DominicLuidold
Copy link
Contributor

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
Issues/
LicenseMIT

This PR fixes two cases where an emptykeys array is passed to aPUT/DELETE request, resulting in a Lokalise API error.

The empty arrays are the result of aSymfony\Component\Translation\TranslatorBag containing one or moreSymfony\Component\Translation\MessageCataloguewithout any messages getting passed into theSymfony\Component\Translation\Bridge\Lokalise\LokaliseProvider (which is expected behaviour, seehere and below).

This is the case if either

  • bin/console translation:push lokalise
  • bin/console translation:push lokalise --delete-missing

is called when both the local translations as well as the translations on Lokalise match 1:1 for a given translation domain.

This will fix the following erros that might be observed while running the mentioned commands:

Before/after fortranslation:push lokalise

Before:

$bin/console translation:push lokalise --domains=validatorsERROR     [app] Unable to get keys ids from Lokalise: "{"error":{"message":"`filter_filenames` parameter has invalid values","code":400}}". [OK] All local translations has been sent to "lokalise" (for "de, en, fr, it" locale(s), and "validators"      domain(s)).

After:

$bin/console translation:push lokalise --domains=validators [OK] All local translations has been sent to "lokalise" (for "de, en, fr, it" locale(s), and "validators"      domain(s)).
Before/after fortranslation:push lokalise --delete-missing

Before:

$bin/console translation:push lokalise --domains=validators --delete-missingIn LokaliseProvider.php line 135:  Unable to delete keys from Lokalise: "{"error":{"message":"`keys` parameter is not valid","code":400}}".translation:push [--force] [--delete-missing] [--domains [DOMAINS]] [--locales [LOCALES]] [--] [<provider>]

After:

$bin/console translation:push lokalise --domains=validators --delete-missing [OK] Missing translations on "lokalise" has been deleted (for "de, en, fr, it" locale(s), and "validators"      domain(s)). [OK] All local translations has been sent to "lokalise" (for "de, en, fr, it" locale(s), and "validators"      domain(s)).

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.3 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbotcarsonbot changed the title[Translation][Bridge][Lokalise] Fix empty keys array in PUT, DELETE requests causing Lokalise API error[Translation] [Bridge][Lokalise] Fix empty keys array in PUT, DELETE requests causing Lokalise API errorNov 25, 2024
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

Nice thanks

@DominicLuidold
Copy link
ContributorAuthor

@nicolas-grekas Thanks for your review!

Thefailing tests seem unrelated. :)

@nicolas-grekasnicolas-grekasforce-pushed thefix_translation-bridge-lokalise-empty-encoded-keys-array branch from0c17119 to2e51808CompareNovember 25, 2024 15:59
@nicolas-grekas
Copy link
Member

Thank you@DominicLuidold.

DominicLuidold reacted with heart emoji

@nicolas-grekasnicolas-grekas merged commit294a39f intosymfony:5.4Nov 25, 2024
8 checks passed
@fabpotfabpot mentioned this pull requestNov 27, 2024
@DominicLuidoldDominicLuidold deleted the fix_translation-bridge-lokalise-empty-encoded-keys-array branchNovember 27, 2024 12:49
This was referencedNov 27, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.4
Development

Successfully merging this pull request may close these issues.

3 participants
@DominicLuidold@carsonbot@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp