def add_translation(self, lang, s): """ Use this method to add translations that are included directly in the lesson file like this: name = "major" name[no] = "dur" """ if lang in i18n.langs(): # i18n.langs() has a list of the langauges we can use. # The first language in the list is preferred. new_pos = i18n.langs().index(lang) if not self.m_added_language: old_pos = sys.maxint else: old_pos = i18n.langs().index(self.m_added_language) if new_pos < old_pos: retval = istr(s) retval.m_added_language = lang retval.cval = self.cval return retval return self
def add_translation(self, lang, s): """ Use this method to add translations that are included directly in the lesson file like this: name = "major" name[no] = "dur" """ if lang in i18n.langs(): # i18n.langs() has a list of the langauges we can use. # The first language in the list is preferred. new_pos = i18n.langs().index(lang) if not self.m_added_language: old_pos = sys.maxsize else: old_pos = i18n.langs().index(self.m_added_language) if new_pos < old_pos: retval = istr(s) retval.m_added_language = lang retval.cval = self.cval return retval return self
def __init__(self, options): """ options -- command line options parsed by optparse """ cfg.ConfigUtils.__init__(self, 'solfege-app') lessonfile.MusicBaseClass.temp_dir = tempfile.mkdtemp(prefix="solfege-") os.environ['SOLFEGETEMPDIR'] = lessonfile.MusicBaseClass.temp_dir # test_mode is when we are running a test from the Tests menu self.m_test_mode = False self.m_options = options self.m_teachers = {} self.m_running_exercise = None self.m_sound_init_exception = None # self.m_userman_language = "C" for lang in i18n.langs(): if os.path.isdir(os.path.join('help', lang)): self.m_userman_language = lang break
def __init__(self, options): """ options -- command line options parsed by optparse """ cfg.ConfigUtils.__init__(self, 'solfege-app') lessonfile.MusicBaseClass.temp_dir = tempfile.mkdtemp( prefix="solfege-") os.environ['SOLFEGETEMPDIR'] = lessonfile.MusicBaseClass.temp_dir # test_mode is when we are running a test from the Tests menu self.m_test_mode = False self.m_options = options self.m_teachers = {} self.m_running_exercise = None self.m_sound_init_exception = None # self.m_userman_language = "C" for lang in i18n.langs(): if os.path.isdir(os.path.join('help', lang)): self.m_userman_language = lang break