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

No default language, card crashes when using "Norwegian Bokmål" (language code "no") #30

Open
mariwing opened this issue Sep 8, 2020 · 2 comments
Assignees

Comments

@mariwing
Copy link

mariwing commented Sep 8, 2020

Describe the bug
When language set to "Norwegian Bokmål" on the user profile, the card crashes due to unkown language code "no". If I change it to English the card works as expected.

To Reproduce
Click on your name in left menu and change to language "Norwegian Bokmål". Go back to the view where you have added the card and you will see that it doesn't render. In developer tools, you will find this:

Uncaught (in promise) Error: No language undefined.
doHumanization sun-card.js:452
humanize sun-card.js:452
renderDaylight sun-card.js:700
render sun-card.js:620
update sun-card.js:186
update sun-card.js:616
performUpdate sun-card.js:148
_enqueueUpdate sun-card.js:148
_requestUpdate sun-card.js:148
initialize sun-card.js:148
initialize sun-card.js:186
J sun-card.js:148
ne sun-card.js:186
a sun-card.js:616
createElement ute:1
s chunk.c136a66895309b59c3fe.js:13138
d chunk.c136a66895309b59c3fe.js:13138
d chunk.c136a66895309b59c3fe.js:13138
l chunk.c136a66895309b59c3fe.js:13138
Vt chunk.c136a66895309b59c3fe.js:12159
value chunk.c136a66895309b59c3fe.js:23707
value chunk.c136a66895309b59c3fe.js:24142
value chunk.c136a66895309b59c3fe.js:23707
n app.664a8247.js:1
d chunk.c136a66895309b59c3fe.js:13138
sun-card.js:452:212500
_enqueueUpdate sun-card.js:148
InterpretGeneratorResume self-hosted:1478
AsyncFunctionNext self-hosted:684
(Async: async)
_requestUpdate sun-card.js:148
initialize sun-card.js:148
initialize sun-card.js:186
J sun-card.js:148
ne sun-card.js:186
a sun-card.js:616
createElement ute:1
s chunk.c136a66895309b59c3fe.js:13138
d chunk.c136a66895309b59c3fe.js:13138
d chunk.c136a66895309b59c3fe.js:13138
l chunk.c136a66895309b59c3fe.js:13138
Vt chunk.c136a66895309b59c3fe.js:12159
value chunk.c136a66895309b59c3fe.js:23707
value chunk.c136a66895309b59c3fe.js:24142
value chunk.c136a66895309b59c3fe.js:23707
n app.664a8247.js:1
d chunk.c136a66895309b59c3fe.js:13138

Expected behavior
Fallback to a defined language if the card stumbles upon a unknown language. I would guess english is a good default language.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Firefox
  • Version 80.0.1

Additional context
If given pointers to where I should add translations for "no" I can submit a PR

@mariwing
Copy link
Author

mariwing commented Sep 8, 2020

More information; hardcoding 'no' as language in the .js file the card works (humanize-duration-ts supports Norwegian) and displays norwegian for sunset and the length of day.

I would therefore suspect that this line is not picking up the language code correctly for some reason:

language: hass.language.split('-')[0],

@palengh
Copy link

palengh commented May 22, 2021

Same issue here: shows up in Lovelace only when language set to English, not to Norwegian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants