Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-02-17 00:14:32 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-02-17 00:14:32 (GMT)
commit50131bb969448503183e04e7a4d496c64c6d7d76 (patch)
tree2e3aa065f4df2602e40bc96a058c1e7f622270b9
parent80a0aa8339d4c6857283c32d22b23d6b9b8b2290 (diff)
Remove redundant lang combo
-rw-r--r--i18n.py171
-rw-r--r--po/de.po28
-rw-r--r--poll.py20
3 files changed, 0 insertions, 219 deletions
diff --git a/i18n.py b/i18n.py
deleted file mode 100644
index b31f766..0000000
--- a/i18n.py
+++ /dev/null
@@ -1,171 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-
-
-### SliderPuzzeUI
-### TODO: Describe
-### $Id: $
-###
-### author: Carlos Neves (cn (at) sueste.net)
-### (c) 2007 World Wide Workshop Foundation
-
-import os
-import gettext
-import locale
-
-import gtk, gobject
-
-_ = lambda x: x
-
-# Images were taken from http://www.sodipodi.com/
-# except for korea taken from http://zh.wikipedia.org/wiki/Image:Unification_flag_of_Korea.svg
-
-lang_name_mapping = {
- 'zh_cn':(None, _('Chinese (simplified)'), 'china'),
- 'zh_tw':(None, _('Chinese (traditional)'), 'china'),
- 'cs':(None, _('Czech'),'czech_republic'),
- 'da':(None, _('Danish'),'denmark'),
- 'nl':(None, _('Dutch'), 'netherlands'),
- 'en':('English', _('English'),'united_states'),
- 'en_gb':('English', _('English - Great Britain'),'united_kingdom'),
- 'en_us':('English', _('English - U.S.'),'united_states'),
- 'fi':(None, _('Finnish'),'finland'),
- 'fr':('Français', _('French'),'france'),
- 'de':(None, _('German'),'germany'),
- 'hu':(None, _('Hungarian'),'hungary'),
- 'it':(None, _('Italian'),'italy'),
- 'ja':(None, _('Japanese'),'japan'),
- 'ko':(None, _('Korean'),'korea'),
- 'no':(None, _('Norwegian'),'norway'),
- 'pl':(None, _('Polish'),'poland'),
- 'pt':('Português', _('Portuguese'),'portugal'),
- 'pt_br':('Português do Brasil', _('Portuguese - Brazilian'),'brazil'),
- 'ru':(None, _('Russian'),'russian_federation'),
- 'sk':(None, _('Slovak'),'slovenia'),
- 'es':('Español', _('Spanish'),'spain'),
- 'sv':(None, _('Swedish'),'sweden'),
- 'tr':(None, _('Turkish'),'turkey'),
- }
-
-class LangDetails (object):
- def __init__ (self, code, name, image):
- self.code = code
- self.country_code = self.code.split('_')[0]
- self.name = name
- self.image = image
-
- def guess_translation (self, fallback=False):
- try:
- self.gnutranslation = gettext.translation(
- 'org.worldwideworkshop.PollBuilder',
- languages=[self.code], fallback=fallback)
- return True
- except:
- return False
-
- def install (self):
- self.gnutranslation.install()
-
- def matches (self, code, exact=True):
- if exact:
- return code.lower() == self.code.lower()
- return code.split('_')[0].lower() == self.country_code.lower()
-
-def get_lang_details (lang):
- mapping = lang_name_mapping.get(lang.lower(), None)
- if mapping is None:
- # Try just the country code
- lang = lang.split('_')[0]
- mapping = lang_name_mapping.get(lang.lower(), None)
- if mapping is None:
- return None
- if mapping[0] is None:
- return LangDetails(lang, mapping[1], mapping[2])
- return LangDetails(lang, mapping[0], mapping[2])
-
-def list_available_translations ():
- rv = [get_lang_details('en')]
- rv[0].guess_translation(True)
- for i,x in enumerate([x for x in os.listdir('locale') if os.path.isdir('locale/' + x) and not x.startswith('.')]):
- try:
- details = get_lang_details(x)
- if details is not None:
- if details.guess_translation():
- rv.append(details)
- except:
- raise
- pass
- return rv
-
-class LanguageComboBox (gtk.ComboBox):
- def __init__ (self):
- liststore = gtk.ListStore(gobject.TYPE_STRING)
- gtk.ComboBox.__init__(self, liststore)
-
- self.cell = gtk.CellRendererText()
- self.pack_start(self.cell, True)
- self.add_attribute(self.cell, 'text', 0)
-
- self.translations = list_available_translations()
- for i,x in enumerate(self.translations):
- liststore.insert(i+1, (gettext.gettext(x.name), ))
- self.connect('changed', self.install)
-
- def modify_bg (self, state, color):
- setattr(self.cell, 'background-gdk',color)
- setattr(self.cell, 'background-set',True)
-
- def install (self, *args):
- if self.get_active() > -1:
- self.translations[self.get_active()].install()
- else:
- code, encoding = locale.getdefaultlocale()
- # Handle default locale of None:
- if code is None:
- self.set_active(0)
- if self.get_active() < 0:
- # Try to find the exact translation
- for i,t in enumerate(self.translations):
- if t.matches(code):
- self.set_active(i)
- break
- if self.get_active() < 0:
- # Failed, try to get the translation based only in the country
- for i,t in enumerate(self.translations):
- if t.matches(code, False):
- self.set_active(i)
- break
- if self.get_active() < 0:
- # nothing found, select first translation
- self.set_active(0)
- # Allow for other callbacks
- return False
-
-###
-def gather_other_translations ():
- from glob import glob
- entries = filter(lambda x: os.path.isdir(x), glob('images/*'))
- entries.extend(filter(lambda x: os.path.isdir(x), glob('lessons/*')))
- entries = map(lambda x: os.path.basename(x), entries)
- f = file('i18n_misc_strings.py', 'w')
- for e in entries:
- f.write('_("%s")\n' % e)
- f.close()
-
-if __name__ == '__main__':
- gather_other_translations()
diff --git a/po/de.po b/po/de.po
index 4e608f1..6ae7e1e 100644
--- a/po/de.po
+++ b/po/de.po
@@ -16,108 +16,87 @@ msgstr ""
"X-Generator: Pootle 1.1.0rc2\n"
#: activity/activity.info:2
-#, fuzzy
msgid "Poll"
msgstr "Abstimmung"
#: poll.py:280
-#, fuzzy
msgid "VOTE!"
msgstr "ABSTIMMEN!"
#: poll.py:282
-#, fuzzy
msgid "Poll Preview"
msgstr "Abstimmungsvorschau"
#: poll.py:316 poll.py:1084
-#, fuzzy
msgid "Choose a Poll"
msgstr "Abstimmung auswählen"
# (Markus S.) 'STIMME'?
#: poll.py:369
-#, fuzzy
msgid "VOTE"
msgstr "ABSTIMMEN"
#: poll.py:371
-#, fuzzy
msgid "SEE RESULTS"
msgstr "ERGEBNISSE"
#: poll.py:380
-#, fuzzy
msgid "DELETE"
msgstr "LÖSCHEN"
#: poll.py:407 poll.py:968
-#, fuzzy
msgid "Lesson Plans"
msgstr "Übungspläne"
#: poll.py:576
-#, fuzzy
msgid "votes"
msgstr "Stimmen"
#: poll.py:592 poll.py:879
-#, fuzzy
msgid "Vote"
msgstr "Abstimmen"
#: poll.py:600
-#, fuzzy
msgid "Edit Poll"
msgstr "Abstimmung bearbeiten"
#: poll.py:603
-#, fuzzy
msgid "Save Poll"
msgstr "Abstimmung speichern"
#: poll.py:681 poll.py:1079
-#, fuzzy
msgid "Build a Poll"
msgstr "Abstimmung erstellen"
#: poll.py:699
-#, fuzzy
msgid "Poll Title:"
msgstr "Abstimmungstitel"
#: poll.py:710
-#, fuzzy
msgid "Question:"
msgstr "Frage:"
#: poll.py:720
-#, fuzzy
msgid "Number of votes to collect:"
msgstr "Zahl der zu sammelnden Stimmen:"
#: poll.py:731
-#, fuzzy
msgid "Answer"
msgstr "Antwort"
#: poll.py:743
-#, fuzzy
msgid "Step 1: Preview"
msgstr "Schritt 1: Vorschau"
#: poll.py:746
-#, fuzzy
msgid "Step 2: Save"
msgstr "Schritt 2: Speichern"
#: poll.py:810
-#, fuzzy
msgid "Favorite Color"
msgstr "Lieblingsfarbe"
#: poll.py:812
-#, fuzzy
msgid "What is your favorite color?"
msgstr "Welches ist deine Lieblingsfarbe?"
@@ -138,39 +117,32 @@ msgid "Orange"
msgstr "Orange"
#: poll.py:814
-#, fuzzy
msgid "None of the above"
msgstr "Keine der angeführten"
#: poll.py:880
#, python-format
-#, fuzzy
msgid "Somebody voted on %s"
msgstr "Jemand stimmte für %s"
#: poll.py:965
-#, fuzzy
msgid "Close Lessons"
msgstr "Übungen beenden"
#: poll.py:1133 poll.py:1159
-#, fuzzy
msgid "Joined"
msgstr "Dazugekommen"
#: poll.py:1163
-#, fuzzy
msgid "Left"
msgstr "Ausgestiegen"
#: poll.py:1470 poll.py:1527
-#, fuzzy
msgid "New Poll"
msgstr "Neue Abstimmung"
#: poll.py:1471 poll.py:1528
#, python-format
-#, fuzzy
msgid "%(author)s shared a poll '%(title)s' with you."
msgstr "%(author)s teilte eine Abstimmung '%(title)s' mit dir."
diff --git a/poll.py b/poll.py
index aa7f621..f4a96a9 100644
--- a/poll.py
+++ b/poll.py
@@ -55,7 +55,6 @@ except:
pass # FIXME remove this once compatibility with Trial 3 not required
from sugar.presence import presenceservice
from abiword import Canvas as AbiCanvas
-from i18n import LanguageComboBox
SERVICE = "org.worldwideworkshop.olpc.PollBuilder"
IFACE = SERVICE
@@ -938,23 +937,6 @@ class PollBuilder(activity.Activity):
' poll closed.',
choice, votersha)
- def _canvas_language_select_box(self):
- """CanvasBox definition for lang select box.
-
- Called from _poll_canvas, _select_canvas, _build_canvas
- """
- languageselectbox = hippo.CanvasBox(
- background_color=style.Color(LIGHT_GREEN).get_int(),
- border_top=4, border_left=4,
- border_color=style.Color(YELLOW).get_int(),
- padding_top=12, padding_bottom=12,
- padding_left=100, padding_right=100,
- orientation=hippo.ORIENTATION_VERTICAL)
- button = LanguageComboBox()
- button.install()
- languageselectbox.append(hippo.CanvasWidget(widget=theme_button(button)))
- return languageselectbox
-
def _canvas_pollbuilder_box(self):
"""CanvasBox definition for pollbuilderbox.
@@ -986,8 +968,6 @@ class PollBuilder(activity.Activity):
background_color=style.Color(LIGHT_GREEN).get_int(),
orientation=hippo.ORIENTATION_HORIZONTAL)
topbox.append(hippo.CanvasWidget(widget=self._logo()))
- languageselectbox = self._canvas_language_select_box()
- topbox.append(languageselectbox, hippo.PACK_EXPAND)
lessonplanbox = self._canvas_lessonplanbox(lesson_return)
topbox.append(lessonplanbox, hippo.PACK_EXPAND)
return topbox