Thread-local locale stack implementation