replace js locale switch with ls, improve variable names