def fallback_trans(x): """For translating placeholder strings the user should never see in raw form, such as 'funny 500 message'. If the string does not translate in the current language, falls back on the 'en' translation that we've hopefully already provided""" t = _(x) if t == x: l = h.get_lang() h.set_lang('en', graceful_fail = True) t = _(x) if l and l[0] != 'en': h.set_lang(l[0]) return t
help="Ignore Categories") parser.add_argument('--no-appendtags',dest='ignore_append_tags',action='store_true', help="Ignore Appending the Tags with # at the End of Each File") parser.add_argument('--no-frontmatter',dest='ignore_front_matter',action='store_true', help="Include YAML Frontmatter") parser.add_argument('-i','--interactive', dest='interactive', action='store_false', help='Silent Non-Interactive Mode') args = parser.parse_args() print(args) prefix_enex_filename = args.filename_format prefix_date_filename = args.filename_format keep_file_names = args.filename_format if args.lang is not None: set_lang(args.lang) else: set_lang() # create an XMLReader parser = xml.sax.make_parser() # turn off namespaces parser.setFeature(xml.sax.handler.feature_namespaces, 0) #override the default ContextHandler Handler = NoteHandler() parser.setContentHandler( Handler ) for i in range(1,len(sys.argv)): # pass in first argument as input file.