briis / weatherbit

The weatherbit integration adds support for the weatherbit.io web service as a source for meteorological data for your location.
MIT License
33 stars 7 forks source link

Translations not working, text falling back to english #56

Closed andilge closed 2 years ago

andilge commented 2 years ago

Hey Bjarne, hi,

I hope you started out fine in 2022.

It appears translations aren't working anymore, I see beaufort descriptions in English with other language configured. Can you please check and advice?

weatherbit cfg

weatherbit english texts

briis commented 2 years ago

Hi Andi, Yes, thank you, it has been a good beginning. I guess these days we are just happy if we have not gotten Covid-19 😁

I can't replicate that. If I set my Home Assistant language to Polski I get the below screens.

It might be a caching issue from and earlier release. Best suggestion is to remove the integration, make sure everything is gone from the custom_components/weatherbit directory and then re-install it.

Skærmbillede 2022-01-16 kl  11 17 19 Skærmbillede 2022-01-16 kl  11 19 38
andilge commented 2 years ago

Hey Bjarne,

Tnx for looking into it and the swift reply.

I smell an issue with locales.

The HA from where I've taken my screen shots above is set up with locale pt-BR, Weatherbit with pt. Can this missmatch provoke english texts as a default fall back?

andilge commented 2 years ago

yup, changing HA locale to pt solves the translation grafik

going back to pt-BR in HA text falls back to english grafik

briis commented 2 years ago

Small thing - BIG effect😁 I will close this now then.

andilge commented 2 years ago

Why closing this now, this is like nothing will be done anymore.

I'm not the only one using locale pt-BR in HA , this has impact on currency abbreviation, decimal separator, format for time and date and other things. pt and pt-BR are litteraly 2 differnt languages, it's like comparing US and UK english.

It has become obvious locale pt-BR isn't supported. Maybe make a copy of pt translation file and make pt-BR of it so if in future somebody wants to translate it differently, it's allready prepared. Other work around is scope only on the first 2 letters of the localization name, neglect dash and everything behind it, but that can have it's limits ...

Up to you, mate, I fully understand you don't want to change a winning team, but now we've found something that improves :-)

briis commented 2 years ago

Fair enough. Could you try and reset your locale, and then make a copy of the two files, and see if that works? If it does, I can then add those to the Integration.

andilge commented 2 years ago

there you go, revamped form actual english file pt and pt-BR translations.zip

briis commented 2 years ago

Without having looked at the files yet, what is the difference - do you have dialects in Poland that is also reflected in the written language? Or what is the locale difference? I am just curious

Anyway, I will add them right now and they will be part of the Integration going forward. Thanks Andi.

andilge commented 2 years ago

yeah, the files have exactly the same content, they are copies with different names. This just to line up the locale that can be set up in HA, no missmatch and fall back to default english. I don't expect this to be a problem, wind rose, cardinal abbreviations, UV level and the few error messages should be ok for both, pt and pt-BR. If ever somebody wants to apply changes, main language in the ones I provided is pt-BR.

European and american portugues have many things in commun, then again there is a delta in vocabulary and gramatics. It's comparable to european and american english and spanish. The 2 just don't go nicely under the same hood and will have difficulties even talking to each other.

briis commented 2 years ago

Fixed in 1.0.7. Not released yet, but will be in there.