From 173a4027019e0adff04534176167ac24a0b303cd Mon Sep 17 00:00:00 2001 From: Sayamindu Dasgupta Date: Sun, 24 Jan 2010 14:58:21 +0000 Subject: Code for language pack support --- diff --git a/src/sugar/activity/i18n.py b/src/sugar/activity/i18n.py new file mode 100644 index 0000000..0963ffa --- /dev/null +++ b/src/sugar/activity/i18n.py @@ -0,0 +1,134 @@ +# 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 _readbin(handle, fmt, bytecount): + read_bytes = handle.read(bytecount) + retvalue = struct.unpack(fmt, read_bytes) + if len(retvalue) == 1: + return retvalue[0] + else: + return retvalue + +def _extract_header(filepath): + header = '' + handle = open(filepath, 'rb') + magic_number = _readbin(handle, '