Skip to content

Conversation

@amieiro
Copy link
Member

@amieiro amieiro commented Jun 10, 2022

What?

This PR checks:

  • the missing uppercase in the beginning of the translations when the original starts with an uppercase.
  • the missing lowercase in the translation when the original string starts with lowercase.

When some of these situations are found, the checker adds a warning.

See #1441.

Why?

In a lot of translations, the translators forget to start the translation with uppercase when the original string starts with uppercase or starts the translation with lowercase when the original starts with lowercase.

How?

This PR:

  • Adds the alphabet used by each locale. This locale was used before the change to use regex to detect if a string starts with uppercase or lowercase. It is ok to delete the changes added in the locales/locales.php file, but it could be useful in the future, and it is a work that takes a few hours.
  • Checks if the first letter of the original and the translation strings starts both with uppercase or lowercase. The check uses a regex, so only makes sense in alphabets with uppercase and lowercase (Latin, Greek, Cyrillic and Armenian).

Testing Instructions

This PR adds some tests for the new warning method. To execute it, run:

  • composer test to run all tests.
  • vendor/bin/phpunit --filter test_missing_uppercase_beginning to run only the new tests.

Screenshots or screencast

image

@amieiro amieiro marked this pull request as ready for review June 10, 2022 16:33
@amieiro amieiro changed the title Add the alphabet for each locale Check the missing uppercase in the beginning of the translations Jun 10, 2022
@amieiro amieiro marked this pull request as draft June 23, 2022 15:41
@amieiro amieiro marked this pull request as ready for review June 23, 2022 17:42
amieiro added 4 commits July 18, 2022 09:29
…rcase

Use regex to detect if the original and the translation start with uppercase
or lowercase.
Sends notifications when a comment changes its status to "approve"
Sends notifications when a comment changes its status to "approve"
@ocean90 ocean90 force-pushed the missing-uppercase branch from 30ca955 to 0c7136c Compare July 18, 2022 07:29
@amieiro amieiro requested a review from ocean90 July 28, 2022 23:40
@akirk
Copy link
Member

akirk commented Aug 30, 2022

Can we split the addition of the alphabet to another PR so that we can ask native speakers to make sure that the chosen alphabet for their language is correct?

@amieiro amieiro requested a review from akirk August 31, 2022 01:15
Copy link
Member

@ocean90 ocean90 left a comment

Choose a reason for hiding this comment

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

All warnings can be discarded so I think we should use the existing wording for the new warnings too.

@amieiro amieiro requested a review from ocean90 September 20, 2022 12:31
@ocean90 ocean90 added this to the 4.0 milestone Oct 11, 2022
@ocean90 ocean90 added the [Type] Enhancement A suggestion for improvement. label Oct 11, 2022
@ocean90 ocean90 merged commit f6c286c into GlotPress:develop Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants