expeyes-junior-doc 674 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#! /usr/bin/python

import sys, os, os.path
from subprocess import call

lang     = os.environ.get('LANG')
language = os.environ.get('LANGUAGE')
lc_all   = os.environ.get('LC_ALL')

preferred='en'
if language and language[0:2] != preferred:
    preferred=language[0:2]
elif lang and lang[0:2] != preferred:
    preferred=lang[0:2]
elif lc_all and lc_all[0:2] != preferred:
    preferred=lc_all[0:2]
if len(sys.argv)>1:
    preferred=sys.argv[1]

pdfTail='eyesj.pdf'
filename=os.path.join('/usr/share/expeyes/doc', preferred+'-'+pdfTail)
if not os.path.exists(filename):
    filename=os.path.join('/usr/share/expeyes/doc', 'en-'+pdfTail)
call('evince '+filename, shell=True)