def trans(self, key) -> str:
        """
        Root Example:
        Translator()
        Translator.trans('messages.hello')
        resources/lang/en/messages.lang will be opened
        and parsed for { 'hello': 'Some english text' }
        If language is fr,
        resources/lang/fr/messages.lang will be opened
        and parsed for { 'hello': 'Some french text' }
        Module Example:
        Translator('[module-name]')
        Translator.trans('messages.hello')
        """

        key_list = self.__list_key(key)
        try:
            current_selection = \
                current_app.config['LANGUAGE_PACKS'][
                    self.module_name][self.app_language]
        except KeyError as error:
            if current_app.config['DEBUG']:
                raise error
            return None
        for parsed_dot_key in key_list:
            try:
                current_selection = current_selection[parsed_dot_key]
            except (Exception, BaseException) as error:
                if current_app.config['DEBUG']:
                    raise error
                return None
        return current_selection
def trans ( self , key ) -> str : key_list = self . __list_key ( key ) try : current_selection = current_app . config [ 'LANGUAGE_PACKS' ] [ self . module_name ] [ self . app_language ] except KeyError as error : if current_app . config [ 'DEBUG' ] : raise error return None for parsed_dot_key in key_list : try : current_selection = current_selection [ parsed_dot_key ] except ( Exception , BaseException ) as error : if current_app . config [ 'DEBUG' ] : raise error return None return current_selection
Root Example:
        Translator()
        Translator.trans('messages.hello')
        resources/lang/en/messages.lang will be opened
        and parsed for { 'hello': 'Some english text' }
        If language is fr,
        resources/lang/fr/messages.lang will be opened
        and parsed for { 'hello': 'Some french text' }
        Module Example:
        Translator('[module-name]')
        Translator.trans('messages.hello')