[Sugar-devel] [PATCH] bundlebuilder should not use locale name

Walter Bender walter.bender at gmail.com
Mon Apr 26 17:42:37 EDT 2010


In regard to http://bugs.sugarlabs.org/ticket/1968

Discussed this morning on IRC: I have an activity that has a different
name in the locale/en.po file than in activity.info. bundlebuilder
uses the locale name to create the .pot file, the .xo and .tar files
whereas I think it should always use the name from the activity.info
file. The attached patch uses the name from activity.info in
bundlebuilder while preserving the locale/ name for user-facing
strings. I opted to add a new method, get_bundle_name so as to
preserve any calls to get_name that expect the localized name.

diff --git a/src/sugar/activity/bundlebuilder.py
b/src/sugar/activity/bundlebuilder.py
index 868ca3d..fc8ebc8 100644
--- a/src/sugar/activity/bundlebuilder.py
+++ b/src/sugar/activity/bundlebuilder.py
@@ -82,7 +82,7 @@ class Config(object):
     def update(self):
         self.bundle = bundle = ActivityBundle(self.source_dir)
         self.version = bundle.get_activity_version()
-        self.activity_name = bundle.get_name()
+        self.activity_name = bundle.get_bundle_name()
         self.bundle_id = bundle.get_bundle_id()
         self.bundle_name = reduce(lambda x, y: x+y, self.activity_name.split())
         self.bundle_root_dir = self.bundle_name + '.activity'
diff --git a/src/sugar/bundle/activitybundle.py
b/src/sugar/bundle/activitybundle.py
index a1f10b9..c83257f 100644
--- a/src/sugar/bundle/activitybundle.py
+++ b/src/sugar/bundle/activitybundle.py
@@ -51,6 +51,7 @@ class ActivityBundle(Bundle):
         self.bundle_exec = None

         self._name = None
+        self._local_name = None
         self._icon = None
         self._bundle_id = None
         self._mime_types = None
@@ -69,6 +70,9 @@ class ActivityBundle(Bundle):
         if linfo_file:
             self._parse_linfo(linfo_file)

+        if self._local_name == None:
+           self._local_name = self._name
+
     def _get_manifest(self):
         if self._manifest is None:
             self._manifest = self._read_manifest()
@@ -217,7 +221,7 @@ class ActivityBundle(Bundle):
         section = 'Activity'

         if cp.has_option(section, 'name'):
-            self._name = cp.get(section, 'name')
+            self._local_name = cp.get(section, 'name')

         if cp.has_option(section, 'tags'):
             tag_list = cp.get(section, 'tags').strip(';')
@@ -240,7 +244,11 @@ class ActivityBundle(Bundle):
         return self._path

     def get_name(self):
-        """Get the activity user visible name."""
+        """Get the activity user-visible name."""
+        return self._local_name
+
+    def get_bundle_name(self):
+        """Get the activity bundle name."""
         return self._name

     def get_installation_time(self):

-walter

-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bundle.patch
Type: text/x-patch
Size: 2149 bytes
Desc: not available
Url : http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100426/d5d1f982/attachment.bin 


More information about the Sugar-devel mailing list