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

Try consistency of tooltips text #4832

Merged
merged 5 commits into from
Feb 5, 2018

Conversation

Rahmon
Copy link
Contributor

@Rahmon Rahmon commented Feb 2, 2018

Description

Some tooltips have title-cased text, some not. @afercia talked about it in issue #4325. So I've tried make all tooltips text with first character uppercase and the others characters lowercase. So I changed tooltip component for that.

I also changed the test because with "Help Text" the tooltip text must be "Help text".

How Has This Been Tested?

This has been tested with "npm test", "npm run test-e2e" and manually on Chrome and Firefox.

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation. #

@aduth
Copy link
Member

aduth commented Feb 2, 2018

Could we just use Lodash's _.upperFirst instead of implementing our own?

@Rahmon
Copy link
Contributor Author

Rahmon commented Feb 2, 2018

Yes, sure, we can use this function.

Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Personally, I'd favor a solution which didn't incur a runtime transform on the text, but rather which could be guarded at a code level via an ESLint rule or equivalent.

That said, this seems like a reasonable interim solution, and I don't expect that there's much of a performance impact 👍

@aduth aduth merged commit e7af21c into WordPress:master Feb 5, 2018
@Rahmon Rahmon deleted the try/consistency-tooltips-text branch February 15, 2018 12:15
@@ -178,7 +178,7 @@ class Tooltip extends Component {
className="components-tooltip"
aria-hidden="true"
>
{ text }
{ upperFirst( toLower( text ) ) }
Copy link
Member

Choose a reason for hiding this comment

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

couldn't this clash with different languages requirements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did some tests with different languages like greek, chinese, korean, russian, persian and hindi. I did not found issues. But it was a quick test. Probably it's necessary investigate more.

Maybe it's better to try via an ESlint rule or equivalent as aduth said.

@mtias mtias added the Internationalization (i18n) Issues or PRs related to internationalization efforts label Feb 16, 2018
@afercia
Copy link
Contributor

afercia commented Feb 17, 2018

Personally, I'd favor a solution which didn't incur a runtime transform on the text, but rather which could be guarded at a code level via an ESLint rule or equivalent.

Yep, maybe I'm a bit old-school but I'm not sure I fully understand why this should be solved via code. To me, it's more a language specific issue and maybe good documentation and ESLint are a reasonable approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internationalization (i18n) Issues or PRs related to internationalization efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants