MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / load

Method load

src/Translate/Translate.py:54–71  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

52 return "<translate %s>" % self.lang
53
54 def load(self):
55 if self.lang == "en":
56 data = {}
57 dict.__init__(self, data)
58 self.clear()
59 elif os.path.isfile(self.lang_file):
60 try:
61 data = json.load(open(self.lang_file, encoding="utf8"))
62 logging.debug("Loaded translate file: %s (%s entries)" % (self.lang_file, len(data)))
63 except Exception as err:
64 logging.error("Error loading translate file %s: %s" % (self.lang_file, err))
65 data = {}
66 dict.__init__(self, data)
67 else:
68 data = {}
69 dict.__init__(self, data)
70 self.clear()
71 logging.debug("Translate file not exists: %s" % self.lang_file)
72
73 def format(self, s, kwargs, nested=False):
74 kwargs["_"] = self

Callers 1

setLanguageMethod · 0.95

Calls 2

errorMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected