-
Notifications
You must be signed in to change notification settings - Fork 18
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
Studio: Translate Studio Assistant Welcome messages #483
Merged
katinthehatsite
merged 2 commits into
trunk
from
fix/translation-of-welcome-messages-for-assistant
Aug 21, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with passing the parameter like this is that the request URL gets formatted like so:
wpcom/v2/studio-app/ai-assistant/welcome?_locale=pl
with underscore which breaks the request to the API and the translation does not come throughThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not adjust the code responsible for that in the custom
request()
function?studio/src/components/auth-provider.tsx
Line 123 in 09f7f3d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @wojtekn ! Interesting, looking at this setting, I see that when you switch to a language other than English, it appends the locale parameter to all requests going to different endpoints. If I remove the
locale
parameter from the/welcome
endpoint, I see it also gets appended:Looking at the original PR where this was introduced - https://github.com/Automattic/local-environment/pull/91 - this seems to have been done so that the locale is set for the duration of the API call.
In regards to this, I have the following question:
/welcome
endpoint and even for the/welcome
endpoint it does not seem to work?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think it's to let API endpoints return localized error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, that makes sense. So if I am testing this correctly, I am seeing the following:
locale
into/welcome
endpoint, I am getting the translations of the messages but I am not getting localized error messages_locale
, I am getting only the localized error messages and not the translated messageslocale
and_locale
- example of the URL:I am seeing two options for this case:
locale
for this specific endpoint since we don't really display the localized error messages that come from the endpoint for the welcome messages.What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: after Slack discussions, we will proceed with the fix of the API endpoint for the welcome messages. I will update here once it is done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wojtekn I prepared a fix here: D158963-code and it needs to be tested in combination with this PR (the testing steps in the PR are updated).
Let me know what you think!