Problem/Motivation

The formatter adds a default colon behind the inline label, as example in in date fields.
This is bad practice. In some languages, like Greek, colon is not even used.
If people want colon on their labels, they can easily add it themselves.

Check this comment;
#67211-41: Show colon after form title only when there is no other punctuation

And what happens when you have a label with other punctuations, like questions marks?
#67211: Show colon after form title only when there is no other punctuation

Steps to reproduce

  1. Create a new field eg., Date in any of the content type.
  2. In the Manage Display, change label to inline.
  3. Create a node with that content type.
  4. Add Greek language in /admin/config/regional/language
  5. Open the newly created node in Greek /el/, there will be a colon ':' after the label.

Proposed resolution

Do something like add it in PHP/twig as a translatable string + context then let people translate it to empty string. See #22.

Remaining tasks

Create a follow up, see #22.
Test
Review

User interface changes

Before:

before

After:

after

API changes

None

Data model changes

None

Release notes snippet

Issue fork drupal-2838547

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

matsbla created an issue. See original summary.

matsbla’s picture

StatusFileSize
new364 bytes
matsbla’s picture

Status: Active » Needs review
matsbla’s picture

Title: Remove default colon behind inline labels in date fields » Remove default colon behind inline labels
Component: datetime.module » Classy theme
Issue summary: View changes

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mukeysh’s picture

StatusFileSize
new24.39 KB

Patch applied successfully. Attaching screenshot for reference.
colon-removed

mukeysh’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Needs work

This is a massive change for existing themes that are using classy. I don't disagree that adding a colon everywhere causes issues but a change like this is likely to "break" many existing sites in the eyes of the users. This issue needs a way to solve both the existing use-case and the broken use case.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

asmita26’s picture

Assigned: Unassigned » asmita26
asmita26’s picture

As per my understanding we need colon only for specific languages and not all. So I thought of providing an option in manage display under label options along with "inline, Hidden" as "Label with colon " which will be theming only in classy theme and this is how it looks. Please refer following screenshots and let me know you view on it.

matsbla’s picture

Hmm. But what if I have a website in one language using colon and another language not using colon? Then I would like to only have the colon for the language where it is appropriate.

asmita26’s picture

In that case if we need the configuration on the basis of language then we can have this under the language add form or we can keep this under configuration in content translation. But not sure how user friendly it would be. Please let me know your take on this.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Component: Classy theme » CSS
Issue summary: View changes
Issue tags: +Bug Smash Initiative, +Needs followup

This was a bugsmash target yesterday. In the discussion were pameeela, catch, lendude, Gábor Hojtsy, smustgrave and myself. To summarize:

Create another issue to remove the colon in starterkit - this is doable without a break for existing sites since that's how starterkit works. I have added the tag 'needs followup' for this and added it to the remaining tasks.

Keep this issue for Olivero/Claro/Umami and move it to the 'CSS' component. I am doing that now. As for a solution the agreement was to do something like add it in PHP/twig as a translatable string + context then let people translate it to empty string.

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new1.65 KB

I have updated it for all the themes expect starterkit theme. I have attached a patch for same. please review

smustgrave’s picture

Status: Needs review » Needs work

Saw the removal which addressed the first part but didn't see "As for a solution the agreement was to do something like add it in PHP/twig as a translatable string + context then let people translate it to empty string"

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

nayana_mvr made their first commit to this issue’s fork.

nayana_mvr’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new199.25 KB
new189.45 KB

I have added the colon ':' as a translatable string in twig template core/themes/claro/templates/classy/field/field.html.twig and created an MR against 11.x branch. Attaching before and after screenshots of a Greek page after translating ':' to an empty string in UI translation for reference.

Before:

before

After:

after

Please review.

smustgrave’s picture

Status: Needs review » Needs work

Per the proposed solution I actually think this should be done in php somehow to the title attributes

nayana_mvr’s picture

Status: Needs work » Needs review

As per feedback comment, I have done the changes using php. Please check if this is fine. Changes in the UI are same as shown in previous screenshots. So not attaching them again.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs followup +Needs Review Queue Initiative
Related issues: +#3482212: Remove the colon in starterkit

Opened #3482212: Remove the colon in starterkit to address follow up. Though I do wonder if that could be rolled up into this now that it's not a twig change. Will let committer decide that but current scope of this issue looks addressed.

quietone’s picture

Assigned: asmita26 » Unassigned

I read the IS, comments and the MR. I see that the follow up has been made, there are no unanswered questions and the core gates are addressed.

I updated credit, hid files, and unassigned.

Leaving at RTBC

nod_’s picture

Status: Reviewed & tested by the community » Needs work

We need more context in the translated string, whitespace rules around colons are different in english and french at least so we need to know a bit more than just ":".

nayana_mvr’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe feedback from @nod_ has been addressed.

matthieuscarset’s picture

Status: Reviewed & tested by the community » Needs review

I think it is great to remove colons after label by default as it causes issues.

However using translations to manage it implies that we'll need to translate all labels if we want to remove colon (e.g. for Greek), add a space before (e.g. French)...etc. This seem to be less convenient than the current implementation in CSS - as of now, if it is easy to customize this with a one line CSS such as:
:lang(el) .field--label-inline .field__label::after { content: ""; }
:lang(fr) .field--label-inline .field__label::after { content: " :"; }

Marking as need review because I suggest we better provide custom CSS rules for the most languages possible in core + add example and documentation for developers to customize this colon for their sites' languages.

asawari’s picture

StatusFileSize
new57.08 KB
new163.84 KB

Hi,
Issue is reproduceable before applying patch.

But after patch is showing an error. Hence unable to retest.
Steps to reproduce-
- Create a new field eg., Date in any of the content type.
- In the Manage Display, change label to inline.
- Create a node with that content type.
- Add Greek language in /admin/config/regional/language
- Open the newly created node in Greek /el/, there will be a colon ':' after the label.

Please refer the attachments.

ericdsd’s picture

@Matthieuscarset, je me dis que ça mériterait même de générer ça avec une variable css

matthieuscarset’s picture

Just opened a MR to fix formatting of inline field label suffix per language with CSS only.

I just made two commits. I dont know why the MR show 450+ commits 🤷... something's wrong.

Need review.

@Eric good idea! I used a CSS variable:

:root {
  --drupal-field-label-inline-suffix: ":";
}
asawari’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new47.43 KB
new57.38 KB

Test status-Pass
Verified on Drupal 11.X version

Test steps -
- Create a new field eg., Date in any of the content type.
- In the Manage Display, change label to inline.
- Create a node with that content type.
- Add Greek language in /admin/config/regional/language
- Open the newly created node in Greek /el/, there will be a colon ':' after the label.

Patch applied successfully. Issue looks fixed. Moving the ticket to RTBC state.
Please refer the attached screenshots.

nod_’s picture

Status: Reviewed & tested by the community » Needs work

The translation approach has been validated in #22, so we won't go with the CSS method. The string translation workflow is well oiled and adding a different way to do this doesn't provide significant benefits.

Here we need to add a context to the string, I suggest: "Field label"

matthieuscarset’s picture

If I understood correctly, using translation means users will need to translate each field labels for every language of a site?

This is a serious amount of work. It makes the current situation worst IMO.

nod_’s picture

it's one string that needs translating, it'll handle all inline fields. No visible changes to users after this patch

smustgrave’s picture

Closed #3482212: Remove the colon in starterkit as a duplicate, moving over credit

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.