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

Added Dutch, Norwegian and Swedish translations. #306

Merged
merged 16 commits into from
Aug 5, 2024

Conversation

jonasbkarlsson
Copy link
Owner

No description provided.

@github-actions github-actions bot added the chore A tedious but necessary task label Aug 4, 2024
Copy link

codecov bot commented Aug 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.48%. Comparing base (840176c) to head (d18d369).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #306   +/-   ##
=======================================
  Coverage   99.48%   99.48%           
=======================================
  Files          14       14           
  Lines        1760     1761    +1     
=======================================
+ Hits         1751     1752    +1     
  Misses          9        9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonasbkarlsson jonasbkarlsson changed the title Added Swedish and Dutch translations. Added Dutch, Norwegian and Swedish translations. Aug 5, 2024
@jonasbkarlsson jonasbkarlsson added minor Create a new minor release and removed chore A tedious but necessary task labels Aug 5, 2024
@github-actions github-actions bot added the chore A tedious but necessary task label Aug 5, 2024
@jonasbkarlsson jonasbkarlsson merged commit aed6104 into main Aug 5, 2024
7 checks passed
@jonasbkarlsson
Copy link
Owner Author

@corvy, the file name no.json didn't work. I changed it to nb.json.

@jonasbkarlsson
Copy link
Owner Author

@corvy, @CasparTheBridge, I have done a pre-release v1.12.0-dev1. Can you check if it looks ok?

@jonasbkarlsson
Copy link
Owner Author

jonasbkarlsson commented Aug 6, 2024

Hmm. Realized that if you set Settings->System->General->Language to something else than English, in order for the entity names to be translated, then also the Entity ID is being translated for newly created instances of the integration. (Existing instances are not affected.)

For example, the entity sensor.ev_smart_charging_charging becomes sensor.ev_smart_charging_opladen when the system languange is set to Dutch.

Not sure that is desirable. The documentation of the integration assumed English Entity IDs, and if someone creates a new issue, it will be complicated for me to understand which entity is which...

Maybe there is a way to keep the Entity IDs in English, while the entity name is being translated. Anyone who knows?

@corvy
Copy link

corvy commented Aug 6, 2024

The translation works well at least. 👍 Agree that the entity names should not be translated but I guess that is not a showstopper. Have no idea how to overcome that.

@corvy
Copy link

corvy commented Aug 9, 2024

Found a problem in my setup with this implemented. The attribute names changed, and since I have quite a few automations running that listens for changes in the attributes that becomes a problem. At least it should be mentioned as a breaking change I guess.

Example, before this worked:
{{ state_attr('sensor.ev_sc_eneren_charging', 'Charging start time') != None }}

Now this must be changed to:
{{ state_attr('sensor.ev_sc_eneren_charging', 'charging_start_time') != None }}

And so forth ... no big deal, but I did not notice until about a day and a half ... meanwhile my car did not charge :O

@jonasbkarlsson
Copy link
Owner Author

Thanks for reporting. That's not a wanted consequence. I think I can modify so that the previous attribute names will be used.

@corvy
Copy link

corvy commented Aug 9, 2024

I am fine either way, but I think it would be good for the users to know. Of course having the untranslated strings as attributes would probably make it more consistent across installations and make it easier from a templating perspective I guess.

@jonasbkarlsson
Copy link
Owner Author

Hmm. It was not possilbe to change back to the previous state attribute names. When the state attribute names are translated, the "translation key", ('charging_start_time') in your example, is what will be used in automations (and in dashboards that uses state attributes). And a "translation key" is not allowed to have upper case letters, which the name had before ('Charging start time').

So if state attribute names should be translated, it will be a breaking change...

@corvy
Copy link

corvy commented Aug 9, 2024

Yes, I still think its the right move. Just warn about breaking change. Its a really easy fix when you know about it.

@jonasbkarlsson
Copy link
Owner Author

jonasbkarlsson commented Aug 11, 2024

Yes, I also think it is better to do it properly now, even though it will be an backward-incompatible change.

Also, I have now done a v1.12.0-dev2 that makes sure the entity IDs always will be in English.

@corvy
Copy link

corvy commented Aug 11, 2024

Good call. I will test.

@hmmbob
Copy link
Contributor

hmmbob commented Aug 12, 2024

dev2 works fine here, incl NL translations

Had to change some templates because of the changed attributes, but nothing big. I guess that anyone who uses templates will be fine changing them as well 😉

@corvy
Copy link

corvy commented Aug 12, 2024

For me also, works fine 🤙

@jonasbkarlsson jonasbkarlsson deleted the feature.translation branch January 5, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore A tedious but necessary task minor Create a new minor release translation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants