File:  [LON-CAPA] / doc / loncapafiles / langcheck.piml
Revision 1.1: download - view: text, annotated - select for diffs
Wed Nov 2 13:16:19 2011 UTC (12 years, 6 months ago) by goltermann
Branches: MAIN
CVS tags: HEAD
Added a language check for root bash and OS. Non-english languages can lead to incorrect warnings. Only tested with CentOS but it should work for other distros too.

    1: <piml>
    2: <targetroot>/</targetroot>
    3: <files>
    4: <file>
    5: <target dist="default"></target>
    6: <perlscript mode="fg">
    7: 
    8: print "Checking root bash language";
    9: my $lang = `locale`;
   10: if ($lang =~ "LANG=en") {
   11:     print "... OK\n";
   12: } else {
   13:     print "\n**** WARNING: You seem to have a non-english root bash. This can cause incorrect error messages.\n".
   14:         "    It is recommended to set your bash language to English.\n";   
   15: }
   16: 
   17: my $file = "/etc/sysconfig/i18n";
   18: if (open(my $IN,'<'.$file)) {
   19:     print "Checking OS language";
   20:     if (<$IN> =~ "LANG=\"en") {
   21:         print "... OK\n";
   22:     } else {
   23:         print "\n**** WARNING: You seem to have a non-english operating system. ".
   24:         "It is recommended to set the language in /etc/sysconfig/i18n to English.\n";
   25:     }
   26: }
   27: 
   28: </perlscript>
   29: </file>
   30: </files>
   31: </piml>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>