NaitLee / Cat-Printer

Application supporting Bluetooth thermal “Cat Printers”, for everyone!
GNU General Public License v3.0
334 stars 33 forks source link

i18n.py language detection error #38

Closed Wang-Yue closed 1 year ago

Wang-Yue commented 1 year ago

Here you have self.lang = lang or locale.getdefaultlocale()[0].replace('_', '-')

On my machine

>>> locale.getdefaultlocale()
(None, 'UTF-8')

So gives an error AttributeError: 'NoneType' object has no attribute 'replace'

NaitLee commented 1 year ago

Got it.

Thoughts about what (function call) to fallback next? Or just to English?

Wang-Yue commented 1 year ago

if user's locale is empty, probably fallback to en-US is the best solution

NaitLee commented 1 year ago

It should be fixed by 70cdd84359b12d1ef8d13cd52a3e3caa21a91e44.