slightlynybbled / tk_tools

Python tkinter tools, Python3.7+
MIT License
101 stars 25 forks source link

Calendar translations #31

Closed maicol07 closed 6 years ago

maicol07 commented 6 years ago

Hi, is it possible to translate in different languages the Calendar widget? For exxample, months and days, that are displayed in the Calendar. Thanks

slightlynybbled commented 6 years ago

I'm sure that is is possible, but I have no idea how this might be approached within tkinter. Will tag this as 'help wanted'.

maicol07 commented 6 years ago

How text is displayed? With labels?

ReblochonMasque commented 6 years ago

You might want to look at the local constants accessed by python - I think there is a module in the standard lib that allows to use the system locals, for time, date, and language settings.

ReblochonMasque commented 6 years ago

Here is an approach to set the locale:

https://stackoverflow.com/questions/985505/locale-date-formatting-in-python https://stackoverflow.com/questions/955986/what-is-the-correct-way-to-set-pythons-locale-on-windows/956084#956084

AokiAhishatsu commented 6 years ago

I can confim this is working on Windows (10):

locale.setlocale(locale.LC_ALL, 'deu_deu')

Calendar is shown in german language as expected

slightlynybbled commented 6 years ago

@AokiAhishatsu So does that mean that this is already addressed and there is no need to do anything or is there something that needs to be modified within the package?

ReblochonMasque commented 6 years ago

Thanks for the confirmation @AokiAhishatsu. I agree, the code does not need modification; a nice explanation on how to do this would be welcomed though. The docstring is probably the best place for it.

slightlynybbled commented 6 years ago

This has been addressed with a more comprehensive example and a blurb within the documentation.