diff options
author | Aleksey Lim <alsroot@sugarlabs.org> | 2011-10-06 14:19:13 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@sugarlabs.org> | 2011-10-06 14:19:13 (GMT) |
commit | 58276264a3972c2672fbf83f025aa5a2fae343a6 (patch) | |
tree | 4c757ac12165846ca5b76a18a3a9e06a1fffb940 | |
parent | bf721889be86ba265ce76e60351d2035678ff036 (diff) |
Import 0c7868473daf2f3b9e0986d08a170bc256fb808e commit from http://dev.laptop.org/git/users/sayamindu/langpackgen/
-rw-r--r-- | langpackgen/README | 5 | ||||
-rw-r--r-- | langpackgen/data/langpackgen_82.ini | 147 | ||||
-rw-r--r-- | langpackgen/data/langpackgen_84.ini | 219 | ||||
-rw-r--r-- | langpackgen/data/langpackgen_devel.ini | 141 | ||||
-rw-r--r-- | langpackgen/data/langpackgen_update1.ini | 129 | ||||
-rw-r--r-- | langpackgen/src/LangPackGen/__init__.py | 0 | ||||
-rw-r--r-- | langpackgen/src/LangPackGen/pack_generator.py | 140 |
7 files changed, 781 insertions, 0 deletions
diff --git a/langpackgen/README b/langpackgen/README new file mode 100644 index 0000000..ba75b10 --- /dev/null +++ b/langpackgen/README @@ -0,0 +1,5 @@ +The script is invoked in the form <script> <inifile> <outputdir> +For example: + +python /home/sayamindu/LangPack/v2/pack_generator.py /home/sayamindu/LangPack/v2/langpackgen_update1.ini /home/sayamindu/public_html/langpacks_v2/8.1 + diff --git a/langpackgen/data/langpackgen_82.ini b/langpackgen/data/langpackgen_82.ini new file mode 100644 index 0000000..841f239 --- /dev/null +++ b/langpackgen/data/langpackgen_82.ini @@ -0,0 +1,147 @@ +; TODO: Add description of the fields + +[chat-activity.po] +name = Chat +category = fructose82 +molocation = /home/olpc/Activities/Chat.activity/locale/LL/LC_MESSAGES/org.laptop.Chat.mo +needs_linfo = 1 + +[journal-activity.po] +name = Journal +category = glucose82 +molocation = /usr/share/locale/LL/LC_MESSAGES/org.laptop.JournalActivity.mo +linfolocation = /usr/share/sugar/activities/Journal.activity/locale/LL/activity.linfo +needs_linfo = 1 + +[memorize.po] +name = Memorize +category = honey +molocation = /home/olpc/Activities/Memorize.activity/locale/LL/LC_MESSAGES/org.laptop.Memorize.mo +needs_linfo = 1 + +[oficina.po] +name = Paint +category = honey +molocation = /home/olpc/Activities/Paint.activity/locale/LL/LC_MESSAGES/org.laptop.Oficina.mo +needs_linfo = 1 + +[read-activity.po] +name = Read +category = fructose82 +molocation = /home/olpc/Activities/Read.activity/locale/LL/LC_MESSAGES/org.laptop.sugar.ReadActivity.mo +needs_linfo = 1 + + +[record-activity.po] +name = Record +category = honey +molocation = /home/olpc/Activities/Record.activity/locale/LL/LC_MESSAGES/org.laptop.RecordActivity.mo +needs_linfo = 1 + +[sugar.po] +name = Sugar +category = glucose82 +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar.mo +needs_linfo = 0 + +[sugar-base.po] +name = SugarBase +category = glucose82 +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar-base.mo +needs_linfo = 0 + +[sugar-toolkit.po] +name = SugarToolkit +category = glucose82 +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar-toolkit.mo +needs_linfo = 0 + +[web-activity.po] +name = Browse +category = fructose82 +molocation = /home/olpc/Activities/Browse.activity/locale/LL/LC_MESSAGES/org.laptop.WebActivity.mo +needs_linfo = 1 + +[write.po] +name = Write +category = fructose82 +molocation = /home/olpc/Activities/Write.activity/locale/LL/LC_MESSAGES/org.laptop.AbiWordActivity.mo +needs_linfo = 1 + +[acoustic-measure-activity.po] +name = Distance +category = honey +molocation = /home/olpc/Activities/Distance.activity/locale/LL/LC_MESSAGES/org.laptop.AcousticMeasure.mo +needs_linfo = 1 + +[calculate-activity.po] +name = Calculate +category = fructose82 +molocation = /home/olpc/Activities/Calculate.activity/locale/LL/LC_MESSAGES/org.laptop.Calculate.mo +needs_linfo = 1 + + +;[connect-activity.po] +;name = Connect +;category = honey +;molocation = /home/olpc/Activities/Connect.activity/locale/LL/LC_MESSAGES/org.laptop.Connect.mo + +[measure_activity.po] +name = Measure +category = honey +molocation = /home/olpc/Activities/Measure.activity/locale/LL/LC_MESSAGES/org.laptop.MeasureActivity.mo +needs_linfo = 1 + +[pippy-activity.po] +name = Pippy +category = fructose82 +molocation = /home/olpc/Activities/Pippy.activity/locale/LL/LC_MESSAGES/org.laptop.Pippy.mo +needs_linfo = 1 + +[terminal-activity.po] +name = Terminal +category = fructose82 +molocation = /home/olpc/Activities/Terminal.activity/locale/LL/LC_MESSAGES/org.laptop.Terminal.mo +needs_linfo = 1 + +;TODO ADD log activity +;[slider-puzzle.po] + + +[TamTamEdit.activity.po] +name = TamTamEdit +category = honey +molocation = /home/olpc/Activities/TamTamEdit.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamEdit.mo +needs_linfo = 1 + +[TamTamJam.activity.po] +name = TamTamJam +category = honey +molocation = /home/olpc/Activities/TamTamJam.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamJam.mo +needs_linfo = 1 + +[TamTamMini.activity.po] +name = TamTamMini +category = honey +molocation = /home/olpc/Activities/TamTamMini.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamMini.mo +needs_linfo = 1 + +[TamTamSynthLab.activity.po] +name = TamTamSynthLab +category = honey +molocation = /home/olpc/Activities/TamTamSynthLab.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamSynthLab.mo +needs_linfo = 1 + + + +[etoys.po] +name = etoys +category = etoys +molocation = /usr/share/etoys/locale/LL/LC_MESSAGES/etoys.mo +needs_linfo = 0 + +[sugar-update-control.po] +name = SugarUpdateControl +category = glucose +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar-update-control.mo +needs_linfo = 0 diff --git a/langpackgen/data/langpackgen_84.ini b/langpackgen/data/langpackgen_84.ini new file mode 100644 index 0000000..792a07b --- /dev/null +++ b/langpackgen/data/langpackgen_84.ini @@ -0,0 +1,219 @@ +; TODO: Add description of the fields + +[chat-activity.po] +name = Chat +category = fructose84 +molocation = /home/olpc/Activities/Chat.activity/locale/LL/LC_MESSAGES/org.laptop.Chat.mo +needs_linfo = 1 + +[memorize.po] +name = Memorize +category = honey +molocation = /home/olpc/Activities/Memorize.activity/locale/LL/LC_MESSAGES/org.laptop.Memorize.mo +needs_linfo = 1 + +[oficina.po] +name = Paint +category = honey +molocation = /home/olpc/Activities/Paint.activity/locale/LL/LC_MESSAGES/org.laptop.Oficina.mo +needs_linfo = 1 + +[read-activity.po] +name = Read +category = fructose84 +molocation = /home/olpc/Activities/Read.activity/locale/LL/LC_MESSAGES/org.laptop.sugar.ReadActivity.mo +needs_linfo = 1 + + +[record-activity.po] +name = Record +category = honey +molocation = /home/olpc/Activities/Record.activity/locale/LL/LC_MESSAGES/org.laptop.RecordActivity.mo +needs_linfo = 1 + +[sugar.po] +name = Sugar +category = glucose84 +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar.mo +needs_linfo = 0 + +[sugar-base.po] +name = SugarBase +category = glucose84 +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar-base.mo +needs_linfo = 0 + +[sugar-toolkit.po] +name = SugarToolkit +category = glucose84 +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar-toolkit.mo +needs_linfo = 0 + +[web-activity.po] +name = Browse +category = fructose84 +molocation = /home/olpc/Activities/Browse.activity/locale/LL/LC_MESSAGES/org.laptop.WebActivity.mo +needs_linfo = 1 + +[write.po] +name = Write +category = fructose82 +molocation = /home/olpc/Activities/Write.activity/locale/LL/LC_MESSAGES/org.laptop.AbiWordActivity.mo +needs_linfo = 1 + +[acoustic-measure-activity.po] +name = Distance +category = honey +molocation = /home/olpc/Activities/Distance.activity/locale/LL/LC_MESSAGES/org.laptop.AcousticMeasure.mo +needs_linfo = 1 + +[calculate-activity.po] +name = Calculate +category = fructose +molocation = /home/olpc/Activities/Calculate.activity/locale/LL/LC_MESSAGES/org.laptop.Calculate.mo +needs_linfo = 1 + + +;[connect-activity.po] +;name = Connect +;category = honey +;molocation = /home/olpc/Activities/Connect.activity/locale/LL/LC_MESSAGES/org.laptop.Connect.mo + +[measure_activity.po] +name = Measure +category = honey +molocation = /home/olpc/Activities/Measure.activity/locale/LL/LC_MESSAGES/org.laptop.MeasureActivity.mo +needs_linfo = 1 + +[pippy-activity.po] +name = Pippy +category = fructose +molocation = /home/olpc/Activities/Pippy.activity/locale/LL/LC_MESSAGES/org.laptop.Pippy.mo +needs_linfo = 1 + +[terminal-activity.po] +name = Terminal +category = fructose84 +molocation = /home/olpc/Activities/Terminal.activity/locale/LL/LC_MESSAGES/org.laptop.Terminal.mo +needs_linfo = 1 + +;TODO ADD log activity +;[slider-puzzle.po] + + +[TamTamEdit.activity.po] +name = TamTamEdit +category = honey +molocation = /home/olpc/Activities/TamTamEdit.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamEdit.mo +needs_linfo = 1 + +[TamTamJam.activity.po] +name = TamTamJam +category = honey +molocation = /home/olpc/Activities/TamTamJam.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamJam.mo +needs_linfo = 1 + +[TamTamMini.activity.po] +name = TamTamMini +category = honey +molocation = /home/olpc/Activities/TamTamMini.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamMini.mo +needs_linfo = 1 + +[TamTamSynthLab.activity.po] +name = TamTamSynthLab +category = honey +molocation = /home/olpc/Activities/TamTamSynthLab.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamSynthLab.mo +needs_linfo = 1 + + +[etoys.po] +name = etoys +category = etoys +molocation = /usr/share/etoys/locale/LL/LC_MESSAGES/etoys.mo +needs_linfo = 0 + +[sugar-update-control.po] +name = SugarUpdateControl +category = glucose +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar-update-control.mo +needs_linfo = 0 + +[physics.po] +name = Physics +category = honey +molocation = /home/olpc/Activities/Physics.activity/locale/LL/LC_MESSAGES/org.laptop.physics.mo +needs_linfo = 1 + +[jukebox-activity.po] +name = Jukebox +category = fructose84 +molocation = /home/olpc/Activities/Jukebox.activity/locale/LL/LC_MESSAGES/org.laptop.sugar.Jukebox.mo +needs_linfo = 1 + +[imageviewer-activity.po] +name = Image Viewer +category = fructose84 +molocation = /home/olpc/Activities/ImageViewer.activity/locale/es/LC_MESSAGES/org.laptop.ImageViewerActivity.mo +needs_linfo = 1 + +[speak.po] +name = Speak +category = honey +molocation = /home/olpc/Activities/Speak.activity/locale/LL/LC_MESSAGES/vu.lux.olpc.Speak.mo +needs_linfo = 1 + +[get_books.po] +name = Get Books +category = honey +molocation = /home/olpc/Activities/GetBooks.activity/locale/LL/LC_MESSAGES/org.laptop.sugar.GetBooksActivity.mo +needs_linfo = 1 + +[colors.po] +name = Colors! +category = honey +molocation = /home/olpc/Activities/Colors.activity/locale/LL/LC_MESSAGES/org.laptop.community.Colors.mo +needs_linfo = 1 + +[infoslicer.po] +name = InfoSlicer +category = honey +molocation = /home/olpc/Activities/InfoSlicer.activity/locale/LL/LC_MESSAGES/org.sugarlabs.InfoSlicer.mo +needs_linfo = 1 + +[finance-activity.po] +name = Finance +category = honey +molocation = /home/olpc/Activities/Finance.activity/locale/LL/LC_MESSAGES/org.laptop.community.Finance.mo +needs_linfo = 1 + +[typingturtle.po] +name = Typing Turtle +category = honey +molocation = /home/olpc/Activities/TypingTurtle.activity/locale/LL/LC_MESSAGES/org.laptop.community.TypingTurtle.mo +needs_linfo = 1 + +[labyrinth.po] +name = Labyrinth +category = honey +molocation = /home/olpc/Activities/Labyrinth.activity/locale/LL/LC_MESSAGES/org.gnome.Labyrinth.mo +needs_linfo = 1 + +[moon.po] +name = Moon +category = honey +molocation = /home/olpc/Activities/Moon.activity/locale/LL/LC_MESSAGES/com.garycmartin.Moon.mo +needs_linfo = 1 + +[olpc_switch_desktop.po] +name = OLPCSwitchDesktop +category = olpc_software +molocation = /usr/share/locale/LL/LC_MESSAGES/olpc-switch-desktop.mo +needs_linfo = 0 + +[implode.po] +name = Implode +category = honey +molocation = /home/olpc/Activities/Implode.activity/locale/LL/LC_MESSAGES/com.jotaro.ImplodeActivity.mo +needs_linfo = 1 + +;;FIXME: ./StopWatch.activity/locale/es/LC_MESSAGES/org.laptop.StopWatchActivity.mo diff --git a/langpackgen/data/langpackgen_devel.ini b/langpackgen/data/langpackgen_devel.ini new file mode 100644 index 0000000..27493c8 --- /dev/null +++ b/langpackgen/data/langpackgen_devel.ini @@ -0,0 +1,141 @@ +; TODO: Add description of the fields + +[chat-activity.po] +name = Chat +category = fructose +molocation = /home/olpc/Activities/Chat.activity/locale/LL/LC_MESSAGES/org.laptop.Chat.mo +needs_linfo = 1 + +;[journal-activity.po] +;name = Journal +;category = glucose +;molocation = /usr/share/sugar/activities/Journal.activity/locale/LL/LC_MESSAGES/org.laptop.JournalActivity.mo +;needs_linfo = 1 + +[memorize.po] +name = Memorize +category = honey +molocation = /home/olpc/Activities/Memorize.activity/locale/LL/LC_MESSAGES/org.laptop.Memorize.mo +needs_linfo = 1 + +[oficina.po] +name = Paint +category = honey +molocation = /home/olpc/Activities/Paint.activity/locale/LL/LC_MESSAGES/org.laptop.Oficina.mo +needs_linfo = 1 + +[read-activity.po] +name = Read +category = fructose +molocation = /home/olpc/Activities/Read.activity/locale/LL/LC_MESSAGES/org.laptop.sugar.ReadActivity.mo +needs_linfo = 1 + + +[record-activity.po] +name = Record +category = honey +molocation = /home/olpc/Activities/Record.activity/locale/LL/LC_MESSAGES/org.laptop.RecordActivity.mo +needs_linfo = 1 + +[sugar.po] +name = Sugar +category = glucose +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar.mo +needs_linfo = 0 + +[sugar-base.po] +name = SugarBase +category = glucose +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar-base.mo +needs_linfo = 0 + +[sugar-toolkit.po] +name = SugarToolkit +category = glucose +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar-toolkit.mo +needs_linfo = 0 + +[web-activity.po] +name = Browse +category = fructose +molocation = /home/olpc/Activities/Browse.activity/locale/LL/LC_MESSAGES/org.laptop.WebActivity.mo +needs_linfo = 1 + +[write.po] +name = Write +category = fructose +molocation = /home/olpc/Activities/Write.activity/locale/LL/LC_MESSAGES/org.laptop.AbiWordActivity.mo +needs_linfo = 1 + +[acoustic-measure-activity.po] +name = Distance +category = honey +molocation = /home/olpc/Activities/Distance.activity/locale/LL/LC_MESSAGES/org.laptop.AcousticMeasure.mo +needs_linfo = 1 + +[calculate-activity.po] +name = Calculate +category = fructose +molocation = /home/olpc/Activities/Calculate.activity/locale/LL/LC_MESSAGES/org.laptop.Calculate.mo +needs_linfo = 1 + + +;[connect-activity.po] +;name = Connect +;category = honey +;molocation = /home/olpc/Activities/Connect.activity/locale/LL/LC_MESSAGES/org.laptop.Connect.mo + +[measure_activity.po] +name = Measure +category = honey +molocation = /home/olpc/Activities/Measure.activity/locale/LL/LC_MESSAGES/org.laptop.MeasureActivity.mo +needs_linfo = 1 + +[pippy-activity.po] +name = Pippy +category = fructose +molocation = /home/olpc/Activities/Pippy.activity/locale/LL/LC_MESSAGES/org.laptop.Pippy.mo +needs_linfo = 1 + +[terminal-activity.po] +name = Terminal +category = fructose +molocation = /home/olpc/Activities/Terminal.activity/locale/LL/LC_MESSAGES/org.laptop.Terminal.mo +needs_linfo = 1 + +;TODO ADD log activity +;[slider-puzzle.po] + + +[TamTamEdit.activity.po] +name = TamTamEdit +category = honey +molocation = /home/olpc/Activities/TamTamEdit.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamEdit.mo +needs_linfo = 1 + +[TamTamJam.activity.po] +name = TamTamJam +category = honey +molocation = /home/olpc/Activities/TamTamJam.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamJam.mo +needs_linfo = 1 + +[TamTamMini.activity.po] +name = TamTamMini +category = honey +molocation = /home/olpc/Activities/TamTamMini.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamMini.mo +needs_linfo = 1 + +[TamTamSynthLab.activity.po] +name = TamTamSynthLab +category = honey +molocation = /home/olpc/Activities/TamTamSynthLab.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamSynthLab.mo +needs_linfo = 1 + + + +[etoys.po] +name = etoys +category = etoys +molocation = /usr/share/etoys/locale/LL/LC_MESSAGES/etoys.mo +needs_linfo = 0 + diff --git a/langpackgen/data/langpackgen_update1.ini b/langpackgen/data/langpackgen_update1.ini new file mode 100644 index 0000000..8ddf321 --- /dev/null +++ b/langpackgen/data/langpackgen_update1.ini @@ -0,0 +1,129 @@ +; TODO: Add description of the fields + +[chat-activity.po] +name = Chat +category = fructose82 +molocation = /home/olpc/Activities/Chat.activity/locale/LL/LC_MESSAGES/org.laptop.Chat.mo +needs_linfo = 1 + +[journal-activity.po] +name = Journal +category = update1 +molocation = /usr/share/sugar/activities/Journal.activity/locale/LL/LC_MESSAGES/org.laptop.JournalActivity.mo +needs_linfo = 1 + +[memorize.po] +name = Memorize +category = honey +molocation = /home/olpc/Activities/Memorize.activity/locale/LL/LC_MESSAGES/org.laptop.Memorize.mo +needs_linfo = 1 + +[oficina.po] +name = Paint +category = honey +molocation = /home/olpc/Activities/Paint.activity/locale/LL/LC_MESSAGES/org.laptop.Oficina.mo +needs_linfo = 1 + +[read-activity.po] +name = Read +category = fructose82 +molocation = /home/olpc/Activities/Read.activity/locale/LL/LC_MESSAGES/org.laptop.sugar.ReadActivity.mo +needs_linfo = 1 + + +[record-activity.po] +name = Record +category = update1 +molocation = /home/olpc/Activities/Record.activity/locale/LL/LC_MESSAGES/org.laptop.RecordActivity.mo +needs_linfo = 1 + +[sugar.po] +name = Sugar +category = update1 +molocation = /usr/share/locale/LL/LC_MESSAGES/sugar.mo +needs_linfo = 0 + +[web-activity.po] +name = Browse +category = update1 +molocation = /home/olpc/Activities/Browse.activity/locale/LL/LC_MESSAGES/org.laptop.WebActivity.mo +needs_linfo = 1 + +[write.po] +name = Write +category = fructose82 +molocation = /home/olpc/Activities/Write.activity/locale/LL/LC_MESSAGES/org.laptop.AbiWordActivity.mo +needs_linfo = 1 + +[acoustic-measure-activity.po] +name = Distance +category = honey +molocation = /home/olpc/Activities/AcousticMeasure.activity/locale/LL/LC_MESSAGES/org.laptop.AcousticMeasure.mo +needs_linfo = 1 + +[calculate-activity.po] +name = Calculate +category = fructose82 +molocation = /home/olpc/Activities/Calculate.activity/locale/LL/LC_MESSAGES/org.laptop.Calculate.mo +needs_linfo = 1 + + +;[connect-activity.po] +;name = Connect +;category = honey +;molocation = /home/olpc/Activities/Connect.activity/locale/LL/LC_MESSAGES/org.laptop.Connect.mo + +[measure_activity.po] +name = Measure +category = honey +molocation = /home/olpc/Activities/Measure.activity/locale/LL/LC_MESSAGES/org.laptop.MeasureActivity.mo +needs_linfo = 1 + +[pippy-activity.po] +name = Pippy +category = fructose82 +molocation = /home/olpc/Activities/Pippy.activity/locale/LL/LC_MESSAGES/org.laptop.Pippy.mo +needs_linfo = 1 + +[terminal-activity.po] +name = Terminal +category = fructose82 +molocation = /home/olpc/Activities/Terminal.activity/locale/LL/LC_MESSAGES/org.laptop.Terminal.mo +needs_linfo = 1 + +;TODO ADD log activity +;[slider-puzzle.po] + + +[TamTamEdit.activity.po] +name = TamTamEdit +category = honey +molocation = /home/olpc/Activities/TamTamEdit.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamEdit.mo +needs_linfo = 1 + +[TamTamJam.activity.po] +name = TamTamJam +category = honey +molocation = /home/olpc/Activities/TamTamJam.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamJam.mo +needs_linfo = 1 + +[TamTamMini.activity.po] +name = TamTamMini +category = honey +molocation = /home/olpc/Activities/TamTamMini.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamMini.mo +needs_linfo = 1 + +[TamTamSynthLab.activity.po] +name = TamTamSynthLab +category = honey +molocation = /home/olpc/Activities/TamTamSynthLab.activity/locale/LL/LC_MESSAGES/org.laptop.TamTamSynthLab.mo +needs_linfo = 1 + + + +[etoys.po] +name = etoys +category = etoys +molocation = /usr/share/etoys/locale/LL/LC_MESSAGES/etoys.mo +needs_linfo = 0 + diff --git a/langpackgen/src/LangPackGen/__init__.py b/langpackgen/src/LangPackGen/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/langpackgen/src/LangPackGen/__init__.py diff --git a/langpackgen/src/LangPackGen/pack_generator.py b/langpackgen/src/LangPackGen/pack_generator.py new file mode 100644 index 0000000..2834701 --- /dev/null +++ b/langpackgen/src/LangPackGen/pack_generator.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python + +import ConfigParser + +import sys +import os.path +import subprocess +import tempfile +import shutil + +import translate.storage.po + +LANGS = ['af', 'am', 'ar', 'ay', 'bg', 'bn', 'bn_IN', 'ca', 'de', 'dz', 'el', + 'en', 'es', 'fa', 'fa_AF', 'ff', 'fr', 'gu', 'ha', 'hi', 'ht', 'ig', + 'is', 'it', 'ja', 'km', 'ko', 'mg', 'mk', 'ml', 'mn', 'mr', 'mvo', 'nb', + 'ne', 'nl', 'pa', 'pap', 'pis', 'pl', 'ps', 'pt', 'pt_BR', + 'qu', 'ro', 'ru', 'rw', 'sd', 'si', 'sl', 'ta', 'te', 'th', + 'tpi', 'tr', 'ur', 'vi', 'yo', 'zh_CN', 'zh_TW'] +TRANSLATE_DIR = '/var/lib/pootle/translations' + + +def gen_langpack(lang, tmpdir, configfile, opdir): + + os.mkdir(os.path.join(tmpdir, lang)) + + # Setup.sh is the installer + f = open(os.path.join(tmpdir, lang, 'setup.sh'), 'a') + f.write('#!/bin/bash\n') + + c = ConfigParser.ConfigParser() + c.read(configfile) + + for i in c.sections(): + name = c.get(i, 'name') + cat = c.get(i, 'category') + mo = c.get(i, 'molocation') + needs_linfo = c.getint(i, 'needs_linfo') + try: + linfo = c.get(i, 'linfolocation') + linfo = linfo.replace('LL', lang) + except ConfigParser.NoOptionError: + linfo = os.path.dirname(mo).replace('LL', lang).replace('LC_MESSAGES', + 'activity.linfo') + + pofile = os.path.join(TRANSLATE_DIR, cat, lang, i) + mofile = os.path.join(tmpdir, lang, name + '.mo') + linfofile = os.path.join(tmpdir, lang, name + '.linfo') + cmd = ['msgfmt', pofile, '-o', mofile] + subprocess.call(cmd) # Generate the MO file + if needs_linfo == 1: + gen_linfo(linfofile, name, lang, pofile) # generate the .linfo file + + #f.write('\n\nmkdir -p ' + os.path.dirname(mo.replace('LL', lang))) + if mo.find('/home/olpc') > -1: + # We are installing inside /home/olpc, assign ownership appropriately + install_string = '\n\tinstall -D -b -g olpc -o olpc -m 644 ' + else: + install_string = '\n\tinstall -D -b -m 644 ' + + f.write('\nif [[ -d ' + os.path.dirname(mo[:(mo.find('LL') - 1)]) + ' ]] ; then') + f.write(install_string + name.replace(' ', '\\ ') + '.mo ' + mo.replace('LL', lang)) + + if needs_linfo == 1: + f.write(install_string + name.replace(' ', '\\ ') + '.linfo ' + linfo) + f.write('\nfi\n') + + f.write ('\n\n\ncp uninstall_langpack /usr/bin/uninstall_langpack_' + lang) + + # Some of the directories created are left as root owned. We need to fix that + f.write ('\n\n\nfind /home/olpc/Activities -uid 0 -print0 | xargs -0 chown olpc:olpc') + + f.close() + + os.chmod (os.path.join(tmpdir, lang, 'setup.sh'), 777) + # Installer done + + # Now we write the un-installer + f = open(os.path.join(tmpdir, lang, 'uninstall_langpack'), 'a') + f.write('#!/bin/bash\n') + + for i in c.sections(): + mo = c.get(i, 'molocation') + needs_linfo = c.get(i, 'needs_linfo') + + try: + linfo = c.get(i, 'linfolocation') + linfo = linfo.replace('LL', lang) + except ConfigParser.NoOptionError: + linfo = os.path.dirname(mo).replace('LL', lang).replace('LC_MESSAGES', + 'activity.linfo') + + + f.write ('\nrm -f ' + mo.replace('LL', lang)) + f.write ('\nif [ -f ' + mo.replace('LL', lang) + '~ ]; then\n\tmv ' + + mo.replace('LL', lang) + '~ ' + mo.replace('LL', lang) + + '\nfi') + if needs_linfo == 1: + f.write ('\nrm -f ' + linfo) + f.write ('\nif [ -f ' + linfo + '~ ]; then\n\tmv ' + linfo + + '~ ' + linfo + '\nfi') + + f.close() + os.chmod(os.path.join(tmpdir, lang, 'uninstall_langpack'), 777) + # Uninstaller done + + + # Make the actual self-extracting installer. + # We use a tool called makeself to do this + # See http://megastep.org/makeself/ for more info + mkself_cmd = ['makeself', os.path.join(tmpdir, lang), + os.path.join(opdir, lang + '_lang_pack_v2.sh'), + 'Language pack', './setup.sh'] + subprocess.call(mkself_cmd) + +def gen_linfo(filepath, name, lang, pofile): + """ Generates activity.linfo file from translations from the PO file""" + po = translate.storage.po.pofile.parsefile(pofile) + unit = po.findunit(name) + + if unit.istranslated() == False: + act_name = name # Doh! Not translated. We stick to the English name + else: + act_name = unit.gettarget() + + f = open(filepath, 'a') + f.write('[Activity]\nname = ' + act_name.encode('utf-8')) + f.close() + +if __name__ == '__main__': + dir = tempfile.mkdtemp() + for i in LANGS: + # FIXME: FIXME: This is one of the fugliest hacks I've ever done + # This will be fixed once we move out of the Update-1 support period + # or when we shift the language list to the ini files + if (sys.argv[1].find('update1') > -1 and not os.path.exists(os.path.join(TRANSLATE_DIR, 'update1', i))): + continue + else: + gen_langpack(i, dir, sys.argv[1], sys.argv[2]) + + shutil.rmtree(dir) |