fix bug #19855, unify locale loading code

http://pear.php.net/bugs/bug.php?id=19855