Permalink
Browse files

fix i18n on linux install

  • Loading branch information...
1 parent 798c666 commit 1f1fa125f039213dc2d61c99bd52d8bc207beddb @dae committed Dec 21, 2012
Showing with 10 additions and 23 deletions.
  1. +1 −2 .gitignore
  2. +3 −1 anki/lang.py
  3. +4 −9 aqt/__init__.py
  4. +2 −11 runanki
View
@@ -3,8 +3,7 @@
*.mo
*\#
.*.swp
-samples
-unihan.db
.coverage
aqt/forms
locale
+.idea
View
@@ -73,11 +73,13 @@ def langDir():
os.path.abspath(__file__)), "locale")
if not os.path.exists(dir):
dir = os.path.join(os.path.dirname(sys.argv[0]), "locale")
+ if not os.path.exists(dir):
+ dir = "/usr/share/anki/locale"
return dir
def setLang(lang, local=True):
trans = gettext.translation(
- 'libanki', langDir(), languages=[lang], fallback=True)
+ 'anki', langDir(), languages=[lang], fallback=True)
if local:
threadLocal.currentLang = lang
threadLocal.currentTranslation = trans
View
@@ -5,15 +5,16 @@
from aqt.qt import *
import locale, gettext
import anki.lang
-from anki.consts import HELP_SITE as appHelpSite
-from anki.hooks import runHook
+from anki.consts import HELP_SITE
+from anki.lang import langDir
appVersion="2.0.3"
appWebsite="http://ankisrs.net/"
appChanges="http://ankisrs.net/docs/changes.html"
appDonate="http://ankisrs.net/support/"
appShared="https://ankiweb.net/shared/"
appUpdate="https://ankiweb.net/update/desktop"
+appHelpSite=HELP_SITE
mw = None # set on init
moduleDir = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
@@ -71,12 +72,6 @@ def closeAll(self):
_gtrans = None
_qtrans = None
-def langDir():
- dir = os.path.join(moduleDir, "aqt", "locale")
- if not os.path.exists(dir):
- dir = os.path.join(os.path.dirname(sys.argv[0]), "locale")
- return dir
-
def setupLang(pm, app, force=None):
global _gtrans, _qtrans
try:
@@ -87,7 +82,7 @@ def setupLang(pm, app, force=None):
dir = langDir()
# gettext
_gtrans = gettext.translation(
- 'ankiqt', dir, languages=[lang], fallback=True)
+ 'anki', dir, languages=[lang], fallback=True)
__builtin__.__dict__['_'] = _gtrans.ugettext
__builtin__.__dict__['ngettext'] = _gtrans.ungettext
anki.lang.setLang(lang, local=False)
View
@@ -1,15 +1,6 @@
#!/usr/bin/env python
-import os, sys
-# system-wide install
+import sys
sys.path.insert(0, "/usr/share/anki")
-sys.path.insert(0, "/usr/share/anki/libanki")
-# running from extracted folder
-base = os.path.dirname(os.path.realpath(__file__))
-sys.path.insert(0, base)
-sys.path.insert(0, os.path.join(base, "libanki"))
-# or git
-sys.path.insert(0, os.path.join(base, "..", "libanki"))
-# start
-import anki, aqt
+import aqt
aqt.run()

0 comments on commit 1f1fa12

Please sign in to comment.