Skip to content

Improve translatability of keyphrase length assessment feedback strings#22173

Merged
mhkuu merged 3 commits intotrunkfrom
improve-translatability-of-keyphrase-length-assessment-strings
Apr 11, 2025
Merged

Improve translatability of keyphrase length assessment feedback strings#22173
mhkuu merged 3 commits intotrunkfrom
improve-translatability-of-keyphrase-length-assessment-strings

Conversation

@agnieszkaszuba
Copy link
Copy Markdown
Contributor

@agnieszkaszuba agnieszkaszuba commented Apr 7, 2025

Context

Summary

This PR can be summarized in the following changelog entry:

  • Improves the translatability of feedback strings for the keyphrase length assessment.
  • [shopify-seo] Improves the translatability of feedback strings for the keyphrase length assessment.
  • [yoastseo] Improves the translatability of feedback strings for the keyphrase length assessment.

Relevant technical choices:

  • I lowered the number of maximum eslint warnings from 20 to 19 since I fixed one warnings inside packages/yoastseo/src/scoring/assessments/readability/KeyphraseLengthAssessment.js

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

WordPress

Post in English (a language with function word support)

  • Create a new post
  • Confirm that the keyphrase length assessment returns a red traffic light and the following feedback: Keyphrase length: No focus keyphrase was set for this page. Set a focus keyphrase in order to calculate your SEO score.
  • Add the keyphrase 'cat'
  • Confirm that the keyphrase length assessment returns a green traffic light with the following feedback: Keyphrase length: Good job!
  • Change the keyphrase to: cat food for indoor cats
  • Confirm that the keyphrase length assessment feedback stays the same
  • Change the keyphrase to: cat food for sterilized indoor cats
  • Confirm that the keyphrase length assessment feedback returns an orange traffic light and the following feedback: Keyphrase length: The keyphrase contains 5 content words. That's more than the recommended maximum of 4 content words. Make it shorter!
  • Change the keyphrase to: grain-free cat food for sterilized indoor cats with kidney problems
  • Confirm that the keyphrase length assessment feedback returns a red traffic light and the following feedback: Keyphrase length: The keyphrase contains 9 content words. That's way more than the recommended maximum of 4 content words. Make it shorter!

Post in Catalan (a language without function word support)

  • Change your site language to Catalan
  • Open/create a post and set the keyphrase to gat
  • Confirm that the keyphrase length assessment returns a green traffic light with the following feedback: Keyphrase length: Good job!
  • Change the keyphrase to: menjar per a gats d'interior
  • Confirm that the keyphrase length assessment feedback remains the same
  • Change the keyphrase to: menjar per a gats per a gats d'interior esterilitzats
  • Confirm that the keyphrase length assessment returns an orange traffic light with the following feedback: Keyphrase length: The keyphrase contains 9 words. That's more than the recommended maximum of 6 words. Make it shorter!
  • Change the keyphrase to: menjar per a gats per a gats d'interior esterilitzats amb problemes renals
  • Confirm that the keyphrase length assessment returns a red traffic light with the following feedback: Keyphrase length: The keyphrase contains 12 words. That's way more than the recommended maximum of 6 words. Make it shorter!

Post in Japanese (a language that counts keyphrase length in characters)

Note for acceptance tester: It is possible that the strings get translated to Japanese during the RC period. In that case, the Japanese feedback strings will appear instead of English ones.

  • Change your site language to Japanese
  • Open/create a post and set the keyphrase to
  • Confirm that the keyphrase length assessment (キーフレーズの長さ) returns a green traffic light with the following feedback: キーフレーズの長さ: いいですね !
  • Change the keyphrase to: 室内猫用のキャットフード
  • Confirm that the keyphrase length assessment feedback remains the same
  • Change the keyphrase to: 室内猫用サーモンキャットフード
  • Confirm that the keyphrase length assessment returns an orange traffic light with the following feedback: Keyphrase length: The keyphrase contains 15 character. That's more than the recommended maximum of 12 character. Make it shorter!
    • The untranslated string is grammatically incorrect because Japanese doesn't have plural number. Translating this string should result in a grammatically correct translation in Japanese.
    • When you switch the user language to English, with the site language remaining Japanese, the string should change to say characters instead of character.
  • Change the keyphrase to: 消毒済みの室内飼い猫用のキャットフード
  • Confirm that the keyphrase length assessment returns a red traffic light with the following feedback: Keyphrase length: The keyphrase contains 19 character. That's way more than the recommended maximum of 12 character. Make it shorter!
    • The untranslated string is grammatically incorrect because Japanese doesn't have plural number. Translating this string should result in a grammatically correct translation in Japanese.
    • When you switch the user language to English, with the site language remaining Japanese, the string should change to say characters instead of character.

Product page in English

  • Create a new product
  • Set the keyphrase to cat
  • Confirm that the keyphrase length assessment returns a red traffic light with the following feedback: Keyphrase length: The keyphrase contains 1 content word. That's way less than the recommended minimum of 4 content words. Make it longer!
  • Change the keyphrase to: dry cat food
  • Confirm that the keyphrase length assessment returns an orange traffic light with the following feedback: Keyphrase length: The keyphrase contains 3 content words. That's less than the recommended minimum of 4 content words. Make it longer!
  • Change the keyphrase to: cat food for indoor cats
  • Confirm that the keyphrase length assessment feedback returns a green traffic light and the following feedback: Keyphrase length: Good job!
  • Change the keyphrase to: grain-free cat food for sterilized indoor cats
  • Confirm that the keyphrase length assessment feedback returns an orange traffic light and the following feedback: Keyphrase length: The keyphrase contains 7 content words. That's more than the recommended maximum of 6 content words. Make it shorter!
  • Change the keyphrase to: grain-free cat food for sterilized indoor cats with kidney problems
  • Confirm that the keyphrase length assessment feedback returns a red traffic light and the following feedback: Keyphrase length: The keyphrase contains 9 content words. That's way more than the recommended maximum of 6 content words. Make it shorter!

Product page in Catalan

  • Change your site language to Catalan
  • Open/create a product page and set the keyphrase to gat
  • Confirm that the keyphrase length assessment returns a red traffic light with the following feedback: Keyphrase length: The keyphrase contains 1 word. That's way less than the recommended minimum of 4 words. Make it longer!
  • Change the keyphrase to: aliments sense cereals
  • Confirm that the keyphrase length assessment returns an orange traffic light with the following feedback: Keyphrase length: The keyphrase contains 3 words. That's less than the recommended minimum of 4 words. Make it longer!
  • Change the keyphrase to: menjar per a gats d'interior
  • Confirm that the keyphrase length assessment returns a green traffic light with the following feedback: Longitud de la frase clau: bona feina!
  • Change the keyphrase to: menjar per a gats per a gats d'interior esterilitzats
  • Confirm that the keyphrase length assessment returns an orange traffic light with the following feedback: Keyphrase length: The keyphrase contains 9 words. That's more than the recommended maximum of 6 words. Make it shorter!
  • Change the keyphrase to: menjar per a gats per a gats d'interior esterilitzats amb problemes renals
  • Confirm that the keyphrase length assessment returns a red traffic light with the following feedback: Keyphrase length: The keyphrase contains 12 words. That's way more than the recommended maximum of 6 words. Make it shorter!

Product page in Japanese

Note for acceptance tester: It is possible that the strings get translated to Japanese during the RC period. In that case, the Japanese feedback strings will appear instead of English ones.

  • Change your site language to Japanese
  • Open/create a post and set the keyphrase to
  • Confirm that the keyphrase length assessment returns a red traffic light with the following feedback: Keyphrase length: The keyphrase contains 1 character. That's way less than the recommended minimum of 8 character. Make it shorter!
    • The untranslated string is grammatically incorrect because Japanese doesn't have plural number. Translating this string should result in a grammatically correct translation in Japanese.
    • When you switch the user language to English, with the site language remaining Japanese, the string should change to say characters instead of character.
  • Change the keyphrase to: 健康的な猫の餌
  • Confirm that the keyphrase length assessment returns an orange traffic light with the following feedback: `Keyphrase length: The keyphrase contains 7 character. That's less than the recommended minimum of 8 character. Make it longer!
    • The untranslated string is grammatically incorrect because Japanese doesn't have plural number. Translating this string should result in a grammatically correct translation in Japanese.
    • When you switch the user language to English, with the site language remaining Japanese, the string should change to say characters instead of character.
  • Change the keyphrase to: 室内猫用のキャットフード
  • Confirm that the keyphrase length assessment (キーフレーズの長さ) returns a green traffic light with the following feedback: キーフレーズの長さ: いいですね !
  • Change the keyphrase to: 室内猫用サーモンキャットフード
  • Confirm that the keyphrase length assessment returns an orange traffic light with the following feedback: Keyphrase length: The keyphrase contains 15 character. That's more than the recommended maximum of 12 character. Make it shorter!
    • The untranslated string is grammatically incorrect because Japanese doesn't have plural number. Translating this string should result in a grammatically correct translation in Japanese.
    • When you switch the user language to English, with the site language remaining Japanese, the string should change to say characters instead of character.
  • Change the keyphrase to: 消毒済みの室内飼い猫用のキャットフード
  • Confirm that the keyphrase length assessment returns a red traffic light with the following feedback: Keyphrase length: The keyphrase contains 19 character. That's way more than the recommended maximum of 12 character. Make it shorter!
    • The untranslated string is grammatically incorrect because Japanese doesn't have plural number. Translating this string should result in a grammatically correct translation in Japanese.
    • When you switch the user language to English, with the site language remaining Japanese, the string should change to say characters instead of character.

Shopify

  • Create a product
  • Follow the test instructions from the following scenarios for WordPress:
    • Product page in English
    • Product page in Catalan
    • Product page in Japanese
  • A smoke test is fine, there is no reason to suspect that the changes would work differently in Shopify

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • No impact other than what's covered in the test instructions.

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes https://github.com/Yoast/lingo-other-tasks/issues/487

@agnieszkaszuba agnieszkaszuba added changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog Shopify This PR impacts Shopify. labels Apr 7, 2025
@agnieszkaszuba agnieszkaszuba marked this pull request as ready for review April 8, 2025 09:08
@mhkuu mhkuu added changelog: other Needs to be included in the 'Other' category in the changelog and removed changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog labels Apr 11, 2025
Copy link
Copy Markdown
Contributor

@mhkuu mhkuu left a comment

Choose a reason for hiding this comment

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

CR: Nice work, especially like your function on retrieving feedback tests! 🎉

I've taken the opportunity to do a slight refactoring to remove duplicate code and work with constants instead of strings. I've also improved the JSDoc a bit while I was at it 😸

ACC: Works as advertised! 🎉

@mhkuu mhkuu merged commit 4af07fb into trunk Apr 11, 2025
20 checks passed
@mhkuu mhkuu deleted the improve-translatability-of-keyphrase-length-assessment-strings branch April 11, 2025 10:40
@mhkuu mhkuu added this to the 25.0 milestone Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: other Needs to be included in the 'Other' category in the changelog Shopify This PR impacts Shopify.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants