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
- 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.
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:

After:

API changes
None
Data model changes
None
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #41 | after_2838547.png | 57.38 KB | asawari |
| #41 | before_2838547.png | 47.43 KB | asawari |
| #37 | patchError.png | 163.84 KB | asawari |
| #37 | beforePatch2838547.png | 57.08 KB | asawari |
Issue fork drupal-2838547
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
Comment #2
matsbla commentedComment #3
matsbla commentedComment #4
matsbla commentedComment #8
mukeysh commentedPatch applied successfully. Attaching screenshot for reference.

Comment #9
mukeysh commentedComment #10
alexpottThis 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.
Comment #13
asmita26 commentedComment #14
asmita26 commentedAs 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.
Comment #15
matsbla commentedHmm. 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.
Comment #16
asmita26 commentedIn 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.
Comment #22
quietone commentedThis 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.
Comment #23
gauravvvv commentedI have updated it for all the themes expect starterkit theme. I have attached a patch for same. please review
Comment #24
smustgrave commentedSaw 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"
Comment #28
nayana_mvr commentedI have added the colon ':' as a translatable string in twig template
core/themes/claro/templates/classy/field/field.html.twigand 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:
After:
Please review.
Comment #29
smustgrave commentedPer the proposed solution I actually think this should be done in php somehow to the title attributes
Comment #30
nayana_mvr commentedAs 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.
Comment #31
smustgrave commentedOpened #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.
Comment #32
quietone commentedI 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
Comment #33
nod_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 ":".
Comment #34
nayana_mvr commentedComment #35
smustgrave commentedBelieve feedback from @nod_ has been addressed.
Comment #36
matthieuscarset commentedI 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.
Comment #37
asawari commentedHi,
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.
Comment #38
ericdsd commented@Matthieuscarset, je me dis que ça mériterait même de générer ça avec une variable css
Comment #40
matthieuscarset commentedJust 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:
Comment #41
asawari commentedTest 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.
Comment #42
nod_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"
Comment #43
matthieuscarset commentedIf 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.
Comment #44
nod_it's one string that needs translating, it'll handle all inline fields. No visible changes to users after this patch
Comment #47
smustgrave commentedClosed #3482212: Remove the colon in starterkit as a duplicate, moving over credit