1--- anki-2.0.46/anki/lang.py.orig 2017-08-06 15:30:10.781419237 +0200
2+++ anki-2.0.46/anki/lang.py 2017-08-06 15:31:33.023043036 +0200
3@@ -71,15 +71,7 @@
4 return localTranslation().ungettext(single, plural, n)
5
6 def langDir():
7- dir = os.path.join(os.path.dirname(
8- os.path.abspath(__file__)), "locale")
9- if not os.path.isdir(dir):
10- dir = os.path.join(os.path.dirname(sys.argv[0]), "locale")
11- if not os.path.isdir(dir):
12- dir = "/usr/share/anki/locale"
13- if not os.path.isdir(dir):
14- dir = "/usr/local/share/anki/bin/locale"
15- return dir
16+ return "@anki@/share/locale"
17
18 def setLang(lang, local=True):
19 trans = gettext.translation(
20diff -Nurp anki-2.0.33.orig/anki/sound.py anki-2.0.33/anki/sound.py
21--- anki-2.0.33.orig/anki/sound.py 2015-12-27 11:23:02.334908723 +0100
22+++ anki-2.0.33/anki/sound.py 2015-12-27 11:34:11.863147265 +0100
23@@ -29,8 +29,9 @@ processingDst = u"rec.mp3"
24 processingChain = []
25 recFiles = []
26
27+lameCmd = "@lame@/bin/lame"
28 processingChain = [
29- ["lame", "rec.wav", processingDst, "--noreplaygain", "--quiet"],
30+ [lameCmd, "rec.wav", processingDst, "--noreplaygain", "--quiet"],
31 ]
32
33 # don't show box on windows
34@@ -44,13 +45,6 @@ if isWin:
35 else:
36 si = None
37
38-if isMac:
39- # make sure lame, which is installed in /usr/local/bin, is in the path
40- os.environ['PATH'] += ":" + "/usr/local/bin"
41- dir = os.path.dirname(os.path.abspath(__file__))
42- dir = os.path.abspath(dir + "/../../../..")
43- os.environ['PATH'] += ":" + dir + "/audio"
44-
45 def retryWait(proc):
46 # osx throws interrupted system call errors frequently
47 while 1:
48@@ -62,13 +56,7 @@ def retryWait(proc):
49 # Mplayer settings
50 ##########################################################################
51
52-if isWin:
53- mplayerCmd = ["mplayer.exe", "-ao", "win32"]
54- dir = os.path.dirname(os.path.abspath(sys.argv[0]))
55- os.environ['PATH'] += ";" + dir
56- os.environ['PATH'] += ";" + dir + "\\..\\win\\top" # for testing
57-else:
58- mplayerCmd = ["mplayer"]
59+mplayerCmd = ["@mplayer@/bin/mplayer"]
60 mplayerCmd += ["-really-quiet", "-noautosub"]
61
62 # Mplayer in slave mode
63@@ -220,7 +208,7 @@ class _Recorder(object):
64 self.encode = encode
65 for c in processingChain:
66 #print c
67- if not self.encode and c[0] == 'lame':
68+ if not self.encode and c[0] == lameCmd:
69 continue
70 try:
71 ret = retryWait(subprocess.Popen(c, startupinfo=si))
72diff -Nurp anki-2.0.33.orig/aqt/__init__.py anki-2.0.33/aqt/__init__.py
73--- anki-2.0.33.orig/aqt/__init__.py 2015-12-27 11:23:02.338908782 +0100
74+++ anki-2.0.33/aqt/__init__.py 2015-12-27 12:35:03.405565214 +0100
75@@ -107,7 +107,7 @@ def setupLang(pm, app, force=None):
76 app.setLayoutDirection(Qt.LeftToRight)
77 # qt
78 _qtrans = QTranslator()
79- if _qtrans.load("qt_" + lang, dir):
80+ if _qtrans.load("qt_" + lang, "@qt4@/share/@qt4name@/translations"):
81 app.installTranslator(_qtrans)
82
83 # App initialisation
84diff -Nurp anki-2.0.33.orig/oldanki/lang.py anki-2.0.33/oldanki/lang.py
85--- anki-2.0.33.orig/oldanki/lang.py 2015-12-27 11:23:02.390909551 +0100
86+++ anki-2.0.33/oldanki/lang.py 2015-12-27 14:05:51.663920453 +0100
87@@ -32,11 +32,7 @@ def ngettext(single, plural, n):
88 return localTranslation().ungettext(single, plural, n)
89
90 def setLang(lang, local=True):
91- base = os.path.dirname(os.path.abspath(__file__))
92- localeDir = os.path.join(base, "locale")
93- if not os.path.exists(localeDir):
94- localeDir = os.path.join(
95- os.path.dirname(sys.argv[0]), "locale")
96+ localeDir = "@anki@/share/locale"
97 trans = gettext.translation('libanki', localeDir,
98 languages=[lang],
99 fallback=True)