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

Support for different locales in strftime #78

Open
tigroz opened this issue May 4, 2021 · 4 comments
Open

Support for different locales in strftime #78

tigroz opened this issue May 4, 2021 · 4 comments

Comments

@tigroz
Copy link

tigroz commented May 4, 2021

I am very impressed with the work you have done, I wanted to know if it is possible to use another language to display the names of the days of the week and the months (Italian) I have already changed some settings to display the temperature in Celsius, could you help me?
Immagine

@sidoh
Copy link
Owner

sidoh commented May 4, 2021

Hi @tigroz!

This is a good question. I'm using the native strftime for this functionality. At least in vanilla C, stuff like day of week is locale-specific, which is configured through setlocale.

I have no idea if the ESP32 SDK ships with locales other than English. I would hope it does, but I'm not seeing a ton of information about it.

I'd be happy to experiment with this myself, but if you want to take a stab at it, might be worth just trying to toss an #import <locale.h> at the top of main.cpp and setlocale(LC_ALL "it_IT") somewhere in setup. If this works, I think we could pretty easily expose a setting to configure the locale.

If this doesn't work, I'm afraid the best option is probably to work around it externally. So you'd have whatever is pushing your weather updates also push MQTT variables like day_0_name.

@tigroz
Copy link
Author

tigroz commented May 5, 2021

thank you very much, maybe it is a bit too out of my ability to change the language as you want, since I am here I would like to ask you for another help, I would like to integrate an external temperature sensor but I cannot, this sensor is connected to Home Assistant via zigbee2mqtt, how can I integrate it by replacing the one you entered in the example?
the waveshare display is correctly connected to the mqtt of my server (home assistant) and reads the Openweather weather data but not the data I am trying to get it to read by the temperature sensor
Immagine

@sidoh
Copy link
Owner

sidoh commented May 5, 2021

No worries. In the best case, adding support for different locales should be easy. I'll try to find some time to play around with it.

Happy to help with the other question. I'll move it to another issue, though.

@sidoh
Copy link
Owner

sidoh commented May 9, 2021

Unfortunately this didn't work. I'm guessing that the espressif SDK does not ship with other locales.

If anyone knows of a way around this, please let me know.

@sidoh sidoh changed the title use different Locale (IT) Support for different locales in strftime May 9, 2021
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

2 participants