Skip to content
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

Reword the three switch_as_x alerts to avoid forced lowercase #23481

Closed
wants to merge 5 commits into from

Conversation

NoRi2909
Copy link
Contributor

@NoRi2909 NoRi2909 commented Dec 27, 2024

When you change a switch entity to show up as a light, fan, lock etc. the following alert comes up as soon as you select Update (here in German):

Screenshot 2024-11-05 15 51 46

The new device type is inserted there but forced into lowercase which already causes this to be a spelling mistake in languages like German. The same happens when you revert the change, but here with two occurrences:

Screenshot 2024-11-05 15 57 22

And when you opt to change from one device type to another it gets even messier:

Screenshot 2024-11-05 16 01 52

If you know German grammar you will also have noticed that the lowercase isn't the only issue here, on top we run into a lot of grammar mistakes because it's:

  • der Lüfter (male)
  • die Leuchte (female)
  • das Schloss (neutrum)

in German, and that's getting wrong here all over the place with only one translation of "the" into German. The first screenshot already has the workaround in place suggested below, otherwise it would have the same gender problem.

Proposed change

This PR changes all occurrences of "{domain}" to "''{domain}'' entity" which makes it no longer necessary to force the entity type into lowercase for proper spelling in English.

Thus the forced lowercase is removed in code.

And with all those occurrences now becoming "… a 'Type' entity …" there is no more gender problem in all languages.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

This prepares the three switch_as_x alerts so the entity types do not need to be forced to lowercase in English as this results in broken spelling in all languages that capitalize nouns.
Removes the forced lowercase for the entity types inserted as veriables in the three alert strings.
@NoRi2909

This comment was marked as resolved.

@NoRi2909 NoRi2909 marked this pull request as ready for review December 29, 2024 18:52
@bramkragten bramkragten added the Needs UX Pull requests requiring a review from the Home Assistant design team label Jan 6, 2025
@wendevlin
Copy link
Contributor

Hi @NoRi2909,

I know it is not a correct german sentence, but your change would avoid all other languages just to fix 1.

It is still readable and understandable for us germans and the most important thing is that the content is correct and the user knows whats going on.
I thank you for your idea but this is the wrong approach.

@wendevlin wendevlin closed this Jan 8, 2025
@NoRi2909
Copy link
Contributor Author

NoRi2909 commented Jan 8, 2025

@wendevlin You are overlooking the forced lowercase which is the primary problem here.
This affects many languages, not just German.

So we need to address this. If you want to keep lowercase in English then we need to add lowercase strings for that like we do in many similar strings.

@wendevlin
Copy link
Contributor

@wendevlin You are overlooking the forced lowercase which is the primary problem here. This affects many languages, not just German.

Ok sorry I just speak 2 languages, what other languages are affected?

@NoRi2909
Copy link
Contributor Author

NoRi2909 commented Jan 8, 2025

Judging from what I see in Lokalise Portugese also uses uppercase in all those lowercase strings.
Swiss German is also affected, obviously.

But the second part, the gender problem is affecting more or less every European language. For example in French:

l' interrupteur (the switch)
la lumiere (the light)
le ventilateur (the fan)
la serrure (the lock)
la sirène (the siren)
la vanne (the valve)

Here rewording as suggested with "… a 'Type' entity …" solves the gender problem, too.

I see that the French strings in Lokalise will all break with female entity domains (4 out of the 6 possible ones above) as they are all hard-coded for male:

Ce {domain} sera supprimé et l'interrupteur d'origine sera de nouveau visible. Vos configurations existantes utilisant le {domain} ne fonctionneront plus !

Should be "Cette …" and "la …"

Ce {domain_1} sera supprimé et remplacé par un nouveau {domain_2}. Vos configurations existantes utilisant le {domain_1} ne fonctionneront plus !

Should be "Cette …" , "une nouvelle …" and "la …"

And with a switch in French you have male, but need to write "l'interrupteur" not "le interrupteur", and "un nouvel interrupteur" not "un nouveau interrupteur".

This is exactly the same mess as we have in German, just that we have three genders, not just two.

@NoRi2909
Copy link
Contributor Author

NoRi2909 commented Jan 8, 2025

I just noticed that it gets even worse in French for the "cover" type.

They use "les volets" (plural) for that entity type.

@NoRi2909
Copy link
Contributor Author

NoRi2909 commented Jan 8, 2025

Just for the most common change from a switch to a light most languages don't work with the current wording:

Dutch: "een nieuwe schakelaar" / "een nieuw licht"
Italian: "un nuovo interruttore" / "una nuova luce"
Spanish: "un nuevo interruptor" / "una nueva luz"
Swedish: "en ny switch" / "ett nytt ljus"
Polish: "nowy przełącznik" / "nowe światło"
etc. etc.

@piitaya
Copy link
Member

piitaya commented Jan 8, 2025

Hi 👋
I'm french. I fixed the translation in french to "Volet" as it must be singular form. Thank you.

French is using the form A new "light" entity because of the gender translation. It is such a thing we have to do everywhere so I guess it's up to each language to adapt the message.

For example, for intents, we have translations inside templates to fix that issue : https://github.com/home-assistant/intents/blob/fd7a5beae192c1e346352fb290cdc441181a2456/sentences/fr/_common.yaml#L68-L84

@piitaya
Copy link
Member

piitaya commented Jan 8, 2025

We have multiple options :

  • create a function to lowercase according to the language (case preserved for german for example) (it will not fix gender)
  • duplicate to key for each domain
  • remove the lower case (the solution you propose)
  • add a new "in-sentence" key for each domain (it will not fix gender)

@NoRi2909
Copy link
Contributor Author

NoRi2909 commented Jan 8, 2025

@piitaya This is what it looks like today:

image

And it's the same mess in every European language …

So fixing it at the source in English is the best way to get this into every translation.

@piitaya
Copy link
Member

piitaya commented Jan 8, 2025

Oh right, the confirm is fixed in french but not the change_confirm and the remove_confirm.

EDIT : fixed in lokalise

@NoRi2909
Copy link
Contributor Author

NoRi2909 commented Jan 8, 2025

Yes, now that will work in French, too. I do have the same fixes in place in German for over two months now, but the forced lowercase is still a problem for German.

As there are just seven domains possible for the entity type here you can go the route to add those in lowercase for proper English instead of forcing it in code. We could then use the correct uppercase for nouns in German for those, too.

@wendevlin wendevlin mentioned this pull request Jan 15, 2025
9 tasks
@wendevlin
Copy link
Contributor

Hey @NoRi2909,

I created a fix for that: #23748
We discussed it a lot and I now find out that there is already a helper for this kind of issue called autoCaseNoun

@NoRi2909
Copy link
Contributor Author

Hey @wendevlin that's cool! There are a few other areas where this should solve such issues.

Can't wait to see that live. 👍

@wendevlin
Copy link
Contributor

Hey @wendevlin that's cool! There are a few other areas where this should solve such issues.

Can't wait to see that live. 👍

Okay. Could you do a PR with the other areas where it is needed?

@NoRi2909
Copy link
Contributor Author

There is already one older bug #22601 about that in the Dashboard options.

I'm afraid that the necessary code changes are way too complex for me to handle, especially as these settings for tap or hold actions are inherited by the different card types. So perhaps you can have a look at that one, too.

We do have this every time a settings panel is referenced. In English you prefer to use sentence-casing so these name are forced to lowercase in code. We had this issue here #23372 but solved it by creating a separate lowercase string for English. If autoCaseNoun can handle this that could be fixed using this more elegant approach, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Needs UX Pull requests requiring a review from the Home Assistant design team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Forced lowercase and grammar mess in "change device type of a switch" alerts
5 participants