# ~*~ coding: utf-8 from zope.interface import implements from Products.MetadataPortal.interfaces import ITranslator from Products.MetadataPortal.config import DEFAULT_LANGUAGE class LREKWS(object): """ translates LRE numeric keywords in to words """ implements(ITranslator) mapp = { '91' : {'et': 'Kunstiõpetus', 'en': 'art'}, '131' : {'et': 'Alusharidus', 'en': 'TD:alusharidus'}, '144' : {'et': 'Bioloogia', 'en': 'biology'}, '168' : {'et': 'Majandus', 'en': 'Economics'}, '195' : {'et': 'Keemia, loodusõpetus', 'en': 'chemistry'}, '213' : {'et': 'Ühiskonnaõpetus', 'en': 'society'}, '256' : {'et': 'Informaatika', 'en': 'computer science'}, '383' : {'et': 'Majandus', 'en': 'business education'}, '404' : {'et': 'Haridustehnoloogia', 'en': 'educational technologies'}, '427' : {'et': 'Inglise keel', 'en': 'English language'}, '431' : {'et': 'Loodusõpetus', 'en': 'environmental education'}, '440' : {'et': 'Eesti keel (ema ja võõr)', 'en': 'Estonian language'}, '493' : {'et': 'Soome keel', 'en': 'Finnish language'}, '520' : {'et': 'Prantsuse keel', 'en': 'French language'}, '540' : {'et': 'Geograafia', 'en': 'geography'}, '548' : {'et': 'Saksa keel', 'en': 'German language'}, '576' : {'et': 'Tööõpetus ja käsitöö', 'en': 'handicrafts'}, '590' : {'et': 'Ajalugu', 'en': 'History'}, '710' : {'et': 'Keeleõpetus', 'en': 'language teaching'}, '790' : {'et': 'Matemaatika', 'en': 'mathematics'}, '856' : {'et': 'Muusikaõpetus', 'en': 'music education'}, '858' : {'et': 'Muusika', 'en': 'Music'}, '974' : {'et': 'Kehaline kasvatus', 'en': 'physical education'}, '978' : {'et': 'Füüsika', 'en': 'physics'}, '1017' : {'et': 'Alusharidus', 'en': 'basic skills'}, '1024' : {'et': 'Algõpetus', 'en': 'primary education'}, '1040' : {'et': 'Inimeseõp ja psüh', 'en': 'psychology'}, '1115' : {'et': 'Vene keel', 'en': 'Russian language'}, '1134' : {'et': 'Koolijuhtimine', 'en': 'school management'}, '1209' : {'et': 'Ühiskonnaõpetus', 'en': 'TD:ühiskonnaõpetus'}, '1227' : {'et': 'Erivajadused', 'en': 'special education'}, '1263' : {'et': 'Rootsi keel', 'en': 'Swedish language'}, } def translate(self, lre, lang=None): if lang is None: lang = DEFAULT_LANGUAGE else: if lang not in ['et', 'en']: lang = DEFAULT_LANGUAGE t = self.mapp.get(lre, lre) if isinstance(t, dict): t = t.get(lang) if t is None: return None if not isinstance(t, unicode): t = t.decode('utf-8') return t lrekws = LREKWS()