Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalpa Welivitigoda <callkalpa@gmail.com>2013-08-20 04:00:09 (GMT)
committer Kalpa Welivitigoda <callkalpa@gmail.com>2013-08-20 04:00:09 (GMT)
commit5b9f1e0769472478581a0bae39c3822e7f741208 (patch)
tree4881f862d5435d2a8216d06d3253c0230113ba1c
parent5d2eda643c4db77f77f0cc9bf3e1547bdc1b6a96 (diff)
supports viewing translated contentactivity_help
-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()