zhconv icon indicating copy to clipboard operation
zhconv copied to clipboard

Maybe raise a keyerror is a better way to process the locale not supported

Open Raibows opened this issue 4 years ago • 0 comments

Because return the not actually converted sentence may confuse someone that is careless about the supported locales. And I think raise an error early can stop future big error for user codes.

https://github.com/gumblex/zhconv/blob/078838e6f1427c970d5ede1b229b11048cac78a5/zhconv/zhconv.py#L235-L254

Let's see a mistake that may confuse the users in using the locale:

inputs = "我幹什麼不干你事"
print(convert(temp, locale='zh_cn'))
#output the same as the inputs but no warnings or erros 

Maybe many users like me use zh_cn instead of the correct zh_cn by mistake sometime.

Raibows avatar Apr 22 '21 03:04 Raibows