Problem/Motivation
A (Across) shown in the clue isn't translatable. The same is true for D (Down).

Steps to reproduce
- Open a crossword in a non-English Drupal website
- Read the clue shown on the top
Proposed resolution
Move the string from default.css to Drupal code.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | Schermata del 2021-10-29 12-40-07.png | 39.54 KB | afagioli |
| #8 | crossword--A-D--3245689--8.patch | 909 bytes | danflanagan8 |
| #5 | translate_direction_label_initials-3245689-3.patch | 2.04 KB | afagioli |
| Schermata del 2021-10-25 10-51-01.png | 28.17 KB | afagioli |
Comments
Comment #2
avpadernoThe involved lines in the default.css file are the following.
It's not only A that isn't translatable, but also D.
In Italian, for example, 32A would not make sense, as we say 32 orizzontale (32A) or 2 verticale (2D).
Comment #3
danflanagan8Does anyone have any thoughts on how to move this into code? Would this be part of global configuration for the Crossword module? Or would this be handled by interface translation?
Comment #4
afagioliAnswering to #3, we should keep in mind comment-14232137 to have a single place/approach from which we will handle translations.
Comment #5
afagioliThe attached patch answers to #3, moving the direction label initial from .css to drupal code.
Smaller HTML improvement to the template file applied also.
Comment #6
danflanagan8Thanks for the patch, @afagioli!
I really want to make sure that whatever we do won't cause any regression or changes on existing sites. Currently the direction letter (D or A) only appears when a clue is in the "active clue" section. The attached patch would add the letter into the main clue listings. It would also fail to get the letter to appear with the active clue if the site builder has configured the field formatter not to display the clues lists. See https://git.drupalcode.org/project/crossword/-/blob/8.x-1.x/js/crossword...
I wonder if we could get away with a style tag like this in the
crossword-active-clues.html.twigtemplate:Would that work?
Comment #7
afagioliI agree with you #6 impact on existing sites is surely much lower. On the other side - if I look around - I see the "internal css" usage quite limited.
It's always good to have more options, though.
I feel we will eventually find the most appropriate solution for this context.
Comment #8
danflanagan8Here's a patch that makes A and D translatable!
I think this is the least disruptive way that this can be done for these reasons:
If there is ever a 2.x release, the letters should not be handled through CSS. That was a bad decision, but we're stuck with it in this branch.
Comment #9
gnumatrix commentedGlad to hear I don't have to change anything! But if something comes up that requires a breaking change, just be sure to make a note about it and I'll be happy to make the necessary updates. I like that my site is a good test but I don't want it to be an indirect impediment to progress in any way.
Having content in CSS is as you say perhaps not the best approach, but on the other hand having things in CSS makes it possible to make changes, versus having things not in CSS that are often far more difficult to adjust.
Comment #10
afagioliThat approach in #8 fixes this issue limiting painful side effects, which is good. I always appreciated this module stability.
The CSS choice is not necessarily bad. The "::before" element is widely supported from ages now, and we will able to manage translations via Drupal UI. In this context, works just fine, to me.
Thanks!
Comment #11
afagioliOut of my curiosity: as seen https://drafts.csswg.org/css-pseudo/#generated-content, should we maybe use double colon "::" before pseudo-elements?
Thanks
Comment #12
afagioli500foods is so cool. Congrats!

Comment #13
danflanagan8Interesting thought. I did a little search in core and found that sometimes they use single colon and sometimes they use double colon. I'll leave it like it is with the single colon for now, even though the double colon is probably more technically correct.
100% true, even when the puzzles don't mention Italy! The work @GNUMatrix did on that site has played a HUGE role in making this module better.
Comment #14
afagioliSure :)
Thanks @GNUMatrix
Comment #16
gnumatrix commentedThanks to you both. The only reason my site even has crosswords at all is because it was originally so quick to setup and get working, and worked so well out of the gate. Lots of tweaks since then, but the core bit was pretty great already. Now I have to go and figure out what that black line at the top of the puzzle from that screenshot is doing there ;-)
Comment #17
danflanagan8A true perfectionist, @GNUMatrix!
Comment #18
gnumatrix commentedAha.... Seems someone snuck in some borders when I wasn't looking.
Comment #19
danflanagan8Comment #20
danflanagan8This is in the 8.x-1.4 release, which will be out shortly!