Likely not? A script name isn't required and isn't set by macOS for all the languages. For example, the script name is none if the system language is 'English (US)'.
If there's no script then of course you can't use it, but if there is one you should.
I am not sure what locale should I assign to user_locale in the case of 'zh-Hans-US', 'zh-Hans' isn't a valid locale for both Linux and macOS. Should I reset it to 'C'?
user_locale is a Windows locale, `zh-Hans` should be OK.