Skip to content

Command Palette: Convert commands to sentence case #191

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

Closed
wants to merge 1 commit into from

Conversation

priethor
Copy link
Contributor

@priethor priethor commented Jul 1, 2025

Closes #190

Converts the Command Palette commands to sentence case, aligning with core commands.

Before After
image image

@priethor priethor requested a review from mcsf July 1, 2025 16:37
@priethor priethor self-assigned this Jul 1, 2025
@priethor priethor added the [Type] Bug Something isn't working label Jul 1, 2025
@@ -56,7 +56,7 @@ function acf_commands_init() {
$custom_post_types[] = array(
'name' => $post_type['post_type'],
'all_items' => $labels->all_items,
'add_new_item' => $labels->add_new_item,
'add_new_item' => ucfirst( strtolower( $labels->add_new_item ) ),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I understand, RTL languages don't have upper and lower case, so this shouldn't affect them, nor would they require different treatment; is that correct, @mcsf?

Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't do this 🙈 Operations like this tend to break when applied across different languages, as they make implicit assumptions that don't always apply to all languages.

In this particular change, it breaks for German, where nouns are always capitalized: "book" is "Buch", so "Neues buch hinzufügen" would be very wrong 😬

Basically, localized strings should be left alone (which is also the reason why $labels has so many seemingly redundant strings) -- our best course of action is to continue to use $labels->add_new_item, and to handle the case of the strings in the individual translations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Bernie, I suspected this could not play well in other languages 😅

In this case, the add_new_label in English capitalizes both words, as seen in the Add new X button, whereas core commands for adding new pages don't reuse strings and have their own post/page-specific strings.

My best guess here would be to add a completely new label to avoid breaking others, which aligns with the seemingly redundant strings you mentioned. Do you have any other recommendations?

Copy link

Choose a reason for hiding this comment

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

My best guess here would be to add a completely new label to avoid breaking others, which aligns with the seemingly redundant strings you mentioned. Do you have any other recommendations?

Do you mean a new label which would be the same as add_new_label but with different casing expectations?

Copy link
Contributor Author

@priethor priethor Jul 2, 2025

Choose a reason for hiding this comment

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

I originally meant this, but that's before realizing core add_new_label values have been updated in 6.8 to remove the New part, so what we should do is change the default value for add_new_value to align with core when creating CPTs in SCF (see #193).

@priethor
Copy link
Contributor Author

priethor commented Jul 2, 2025

Closing this PR as it is the wrong approach: these labels can't and shouldn't be tinkered with at the code level, as they are defined through the post type creation UI, which defaults them to Add New X but are ultimately up to the user to set up. If we want these sentences not to be Title case, we should change the default values, but we shouldn't override what the user configures.
image

@priethor priethor closed this Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Commands should be sentence case, not Title Case
3 participants