Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/helpactivity.py
diff options
context:
space:
mode:
Diffstat (limited to 'helpactivity.py')
-rwxr-xr-xhelpactivity.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/helpactivity.py b/helpactivity.py
index 4d7013d..88f5330 100755
--- a/helpactivity.py
+++ b/helpactivity.py
@@ -28,8 +28,6 @@ from sugar3.activity.widgets import StopButton
from viewtoolbar import ViewToolbar
-HOME = 'file://' + os.path.join(activity.get_bundle_path(),
- 'help/index.html')
class HelpActivity(activity.Activity):
@@ -104,7 +102,7 @@ class HelpActivity(activity.Activity):
self.set_canvas(_scrolled_window)
self._web_view.show()
self._web_view.load_uri(HOME)
-
+
class Toolbar(Gtk.Toolbar):
def __init__(self, web_view):
@@ -152,3 +150,14 @@ class Toolbar(Gtk.Toolbar):
def _go_home_cb(self, button):
self._web_view.load_uri(HOME)
+
+# get index.html in the current language
+def get_index_path():
+ locale = os.environ.get('LANG')
+ language = locale.split('.')[0].split('_')[0].lower()
+ path = os.path.join(activity.get_bundle_path(),'help/' + language + '/index.html')
+ if not os.path.isfile(path):
+ path = os.path.join(activity.get_bundle_path(),'help/en/index.html')
+ return 'file://' + path
+
+HOME = get_index_path()