Yes, first read /etc/X11/xorg.conf (if exists), if not read $LANG.
But be aware of this since some distros pack keyboard info into /etc/sysconfig.
Update: keyboard info should be /etc/sysconfig/keyboard (recent distros, just checked Fedora14 and SuSe11.04) BUT ONLY /etc/X11/xorg.conf doesn't have different setup.
So, first check if xorg.conf exists, and if yes -> check if there's keyboard entry. If not , then attack /etc/sysconfig/keyboard