Reputation: 11
I want to change names of weekdays and months, in accordance to my locale (croatian locale) within QCalendar
widget of the PyQt4 project
.
The documentation referring to the problem does have some methods to change the first day of the week and so on, but I never found a way to actually do it.
Is there any way to change it from inside the code or are the names associated with a particular locale that is set up on one Linux or Windows system?
Upvotes: 1
Views: 229
Reputation: 120608
You shouldn't need to do this. Qt should determine the correct locale to use from your system settings. If the correct locale is set, the calendar-widget will show the correctly translated names. You can check this by manually setting the default locale, like so:
QtCore.QLocale.setDefault(QtCore.QLocale('hr_HR'))
But as I say, it really shouldn't be necessary to do this. You can check the default system locale that Qt is using by doing:
loc = QtCore.QLocale.system()
print(loc.name())
If this does not show the correct language, then either your system locale settings are incorrect, or the version of Qt you are using is buggy. One example of a bug that might affect you is this one, which was not properly fixed until Qt-4.8.5.
Upvotes: 1