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

Localization issue #114

Closed
2 tasks done
valepe opened this issue Aug 19, 2022 · 14 comments · Fixed by #123
Closed
2 tasks done

Localization issue #114

valepe opened this issue Aug 19, 2022 · 14 comments · Fixed by #123
Assignees
Labels
bug Something isn't working

Comments

@valepe
Copy link

valepe commented Aug 19, 2022

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser

Release with the issue:
2022.8.6 (HA) - 4.2.4 (Hourly-Weather)

Last working release (if known):
not used before

Browser and Operating System:
Chrome on mac OS and android and Android companion application.

Description of problem:
Issue with the italian localization. The problem is that italian localization already exists but it isn't used in my system and english is used instead (I checked the language selection of my user). So the issue #70 isn't applicable.
Hour format and decimal point are correct.

Javascript errors shown in the web inspector (if applicable):
no errors in console panel


Additional information:
Home Assistant Core running in Docker

@valepe valepe added the bug Something isn't working label Aug 19, 2022
@decompil3d
Copy link
Owner

Can you please check the values of window.localStorage.getItem('selectedlanguage') and window.localStorage.getItem('haServerLanguage')? If you refresh your browser, does it fix the issue?

@valepe
Copy link
Author

valepe commented Aug 19, 2022

Both return null and refreshing (soft and hard) does nothing.

@valepe
Copy link
Author

valepe commented Aug 20, 2022

Forgot to add that this is a manual installation. No HACS

@decompil3d
Copy link
Owner

Hm -- HACS shouldn't have anything to do with it. Can you open your browser dev tools, select the hourly-weather element in the DOM explorer, then go to the console tab and run $0.hass and show me the output. I'm particularly interested in the locale key within. I'm wondering if your card is somehow not receiving proper config from HA.

@valepe
Copy link
Author

valepe commented Aug 22, 2022

Strange, I did it but $0.hass returns undefined

@decompil3d
Copy link
Owner

What about $0.tagName?

@valepe
Copy link
Author

valepe commented Aug 22, 2022

BODY

@decompil3d
Copy link
Owner

Ok, that means that you didn't select the right element in the elements tab. You'll want to use the element finder tool (usually in the top left of the dev tools pane) to select something in the hourly weather card, then scroll through the DOM explorer to find the hourly-weather tag and click it. Then run the $0.hass command in the console.

@valepe
Copy link
Author

valepe commented Aug 22, 2022

Ok, now I selected the right element. Thank you for your help.

This is the response from $0.hass:

...
    "panelUrl": "lovelace",
    "defaultPanel": "lovelace",
    "language": "it",
    "selectedLanguage": null,
    "locale": {
        "language": "it",
        "number_format": "language",
        "time_format": "language"
    },
...

@decompil3d
Copy link
Owner

Are there any script errors in your console? The latest version of this card should be looking at hass.locale.language and using that when selectedLanguage is not defined. But that may not work if script execution is broken earlier.

If not, is there any chance that your HA instance is exposed to public internet? If you want to give me a temporary user account I can try to debug. Otherwise, I'm kinda stuck without a minimal repro here, as this works fine for me.

@valepe
Copy link
Author

valepe commented Aug 23, 2022

No script errors and my HA istance isn't exposed to internet.

Suggestion: can you add a language option in the settings to override the system language?

@decompil3d
Copy link
Owner

@valepe Can you please try version 4.3.0-beta.0 to see if that helps? First, see if it just works due to the refactored logic around getting the HA server language. If not, then you can try setting the new language config option on the card to manually select your language.

@valepe
Copy link
Author

valepe commented Aug 24, 2022

Just tryed. The new detection method failed: language reverts to english.
But language option works fine.

Thanks

@decompil3d
Copy link
Owner

Ok, then I think we'll just move forward with this fix. Not sure why it isn't picking up things in your case otherwise -- will be hard to debug without a concrete repro case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants