Beispiel #1
0
    def translate(self, txt, vars=None, block=None):
        """
        Returns translated text
        """
        txt = str(txt)
        if block:
            self.logger.warning("unsuported 3. parameter '{}' used in translation function _( ... )".format(block))

        if self._add_translation is None:
            # test initially, if plugin has additional translations
            translation_fn = os.path.join(self._plugin_dir, 'locale.yaml')
            self._add_translation = os.path.isfile(translation_fn)

        if self._add_translation:
            return lib_translate(txt, vars, additional_translations='plugin/'+self.get_shortname())
        else:
            return lib_translate(txt, vars)
Beispiel #2
0
    def translate(self, txt, vars=None):
        """
        Returns translated text
        """
        txt = str(txt)

        return lib_translate(txt,
                             vars,
                             additional_translations='module/' +
                             self._shortname)
Beispiel #3
0
    def translate(self, txt, vars=None):
        """
        Returns translated text

        :param txt: text to translate
        :type txt: str

        :return: translated text
        :rtype: str
        """
        txt = str(txt)

        return lib_translate(txt, vars, additional_translations='lib/shtime')