Skip to content
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

Avatar rating text is not translated properly if a user has a custom language Set #89

Conversation

ActuallyConnor
Copy link
Contributor

Description of the Change

Adding string translation method around each $avatar_rating when it is output in the edit_user_profile() method.

Verification Process

  • Site language is set to English

Screen Shot 2021-11-17 at 9 29 43 AM

  • User language is set to French

Screen Shot 2021-11-17 at 9 29 37 AM

  • Rating strings are translated to French

Screen Shot 2021-11-17 at 9 29 28 AM

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

#88

@vikrampm1 vikrampm1 requested review from a team and faisal-alvi and removed request for a team November 17, 2021 15:26
@vikrampm1 vikrampm1 added the type:enhancement New feature or request. label Nov 17, 2021
@jeffpaul jeffpaul added this to the Future Release milestone Nov 17, 2021
@ActuallyConnor ActuallyConnor force-pushed the fix/rating-custom-language-text-translation branch from 0d1d20b to c013a00 Compare November 18, 2021 14:52
@ActuallyConnor
Copy link
Contributor Author

@faisal-alvi I implemented a new solution and left some comments for clarity. Let me know if you have any questions or concerns.

@faisal-alvi
Copy link
Member

@ActuallyConnor Thank you for the improved solution. I've left some suggestions, please check.

Overwriting existing avatar_ratings so this can be called just before the rating strings would be used so that translations will work correctly.

Default text-domain because the strings have already been translated

Using esc_html over $ratings would be an extra improvement
@ActuallyConnor
Copy link
Contributor Author

@faisal-alvi I've made some changes based on your recommendations, let me know what you think

Copy link
Member

@faisal-alvi faisal-alvi left a comment

Choose a reason for hiding this comment

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

@ActuallyConnor the solution looks good, thank you. There are a couple of errors from PHPCS, please fix them. Then we will be good to go.

includes/class-simple-local-avatars.php Outdated Show resolved Hide resolved
@ActuallyConnor
Copy link
Contributor Author

@faisal-alvi those PHPCS errors should be fixed now 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avatar rating text is not translated properly if a user has a custom language set
4 participants