add determine locale function