From e6aa91ba3fd63bb886d41d51f5b52c36d017bdb4 Mon Sep 17 00:00:00 2001 From: Sayamindu Dasgupta Date: Wed, 10 Feb 2010 15:26:32 +0000 Subject: Merge branch 'master' of git://git.sugarlabs.org/sugar-toolkit/gettext-enhancements --- diff --git a/src/sugar/activity/Makefile.am b/src/sugar/activity/Makefile.am index e2e6fdc..2c2eff1 100644 --- a/src/sugar/activity/Makefile.am +++ b/src/sugar/activity/Makefile.am @@ -6,6 +6,7 @@ sugar_PYTHON = \ activityhandle.py \ activityservice.py \ bundlebuilder.py \ + i18n.py \ main.py \ namingalert.py \ widgets.py diff --git a/src/sugar/activity/i18n.py b/src/sugar/activity/i18n.py new file mode 100644 index 0000000..1c3c893 --- /dev/null +++ b/src/sugar/activity/i18n.py @@ -0,0 +1,144 @@ +# Copyright (C) 2010 One Laptop Per Child +# +# Author: Sayamindu Dasgupta +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +import gconf + +import locale +import os +import struct +import sys + +import dateutil.parser +import time + +_MO_BIG_ENDIAN = 0xde120495 +_MO_LITTLE_ENDIAN = 0x950412de + + +def _read_bin(handle, format_string, byte_count): + read_bytes = handle.read(byte_count) + return_value = struct.unpack(format_string, read_bytes) + if len(return_value) == 1: + return return_value[0] + else: + return return_value + + +def _extract_header(file_path): + header = '' + handle = open(file_path, 'rb') + magic_number = _read_bin(handle, '