WIP: Theme styles naming bug (peculiarity) for non-English

Bricks Version: 1.1.4
Browser: Chrome 101.0.4951.64
OS: macOS
URL: Local

Hello.
I found a bug (or rather a peculiarity) of naming theme styles.

If you name the topic in a language other than English, in my case Russian. Then when loading the CSS in a separate file, this name gets into the file name, which is not good.

Of course, the way out is to call everything in English, but not all users will guess about it.

Screenshots:

Hi Alex,
Thanks so much for your report!

You are right that there can be problems with non-Latin characters, but I can’t think of a solution spontaneously. So far there was no report about this, so it seems to be no problem for many users.

Both HTML and CSS use English, and I think every user should stick to that.

Best regards,
timmse

1 Like

Hi Stefan, thanks for the answer.
Yeah, I understand about hypertext and programming languages syntax. However I have the audience 40k+ I believe I’ve seen EVERYTHING :joy:

The ways of users are inscrutable and I have seen a lot of curiosities. Sometimes I wonder “f***, how did you do that!?” :sweat_smile:

Yes, I believe you… I feel the same way with some reports :sweat_smile:
But as I said, I don’t know how we can solve this potential problem without putting in a massive effort. It’s definitely good that you brought this up.

Good news. My friend and Cyr-To-Lat plugin co-developer promise to add Bricks support.

2 Likes

Cool! Until now I did not know that there is such a plugin :slight_smile:

1 Like

Yes it is )) Supports all Cyrillic languages conversion to latin with editable transliteration template. Must have plugin to convert headings to latin slugs, media filenames and more. Author added support of ACF and JetEngine fields IDs conversion from field names. Very useful. Hope he can find a time to add Bricks support too.

1 Like

So, the Cyr-To-Lat plugin developer answered that there is no any hook or filter to link transliteration function. If you can add it, he will add Bricks support.

Hey Alex, good news!
We’ll add the filter in one of the next versions.

Best regards,
timmse

3 Likes

@timmse Just wanted to add to this already great thread.

Fully agree, at the same time I think it isn’t about using English as main software language. It is about the fact that in Bricks, this is a simple “dear user, name your theme style” situation. I guess that average user doesn’t even know that this is later taken as a basis for CSS file name.

So my first recommendation would be to add something like:

  • short text info
  • tooltip
  • naming regex check

That would assure that only simple latin characters are used there.

Another solution would be to normalize the characters before creating the file name. This should be implemented in one go, so not just “cyrylic to latin” or “extended latin to latin”, but a “non-latin to latin”. You can use PHP: Normalizer::normalize - Manual for that.

The last option, I could think of, would be to simply stop naming CSS fils with the user’s theme name. You already name color variables for color palettes with random latin characters and not their user given names. So why not apply the same logic to themes and their files?

I would go for the second or third solution based on implementation time needed.