diff --git a/data/base.en.po b/data/base.en.po index c495155..c3f2f0c 100644 --- a/data/base.en.po +++ b/data/base.en.po @@ -1,5 +1,13 @@ + +#: /usr/lib/lua/luci/view/web/inc/store.htm msgid "开启后,路由器USB接口将工作在3.0模式下。(USB3.0使用时会对2.4G Wi-Fi有些影响)" -msgstr "After turning it on, the router's USB interface will work in 3.0 mode. (USB3.0 will have some impact on 2.4G Wi-Fi)" +msgstr "" +"After turning it on, the router's USB interface will work in 3.0 mode." +" (USB3.0 will have some impact on 2.4G Wi-Fi)" + +# ========================================================================= # +# Data from Xiaomi LMO files # +# ========================================================================= # msgkey 0x0005B8BE msgstr "Repeater mode is on, repeat quality: " diff --git a/data/base.ru.po b/data/base.ru.po index 8f15467..3a2ae60 100644 --- a/data/base.ru.po +++ b/data/base.ru.po @@ -1,3 +1,14 @@ + +#: /usr/lib/lua/luci/view/web/inc/store.htm +msgid "开启后,路由器USB接口将工作在3.0模式下。(USB3.0使用时会对2.4G Wi-Fi有些影响)" +msgstr "" +"После включения USB-интерфейс роутера будет работать в режиме 3.0." +" (USB3.0 окажет некоторое влияние на 2.4G Wi-Fi)" + +# ========================================================================= # +# Data from Xiaomi LMO files # +# ========================================================================= # + msgkey 0x0005B8BE msgstr "Включен режим репитера. Качество: " diff --git a/po2lmo.py b/po2lmo.py index 57f3227..18c9a74 100644 --- a/po2lmo.py +++ b/po2lmo.py @@ -122,6 +122,8 @@ class Lmo: def print_msg(self): msg = self.msg + if not msg.id and not msg.val[0]: + return msg if msg.key is not None: val = msg.val[msg.plural_num] self.add_entry(msg.key, msg.plural_num + 1, val) @@ -175,18 +177,23 @@ class Lmo: line = line.replace('\x02', '\\') return line - def process_line(self, line, eof = False): + def process_line(self, line): msg = self.msg if line.startswith('msgctxt "'): - if msg.id or msg.val[0]: - msg = self.print_msg() + msg = self.print_msg() msg.ctxt = "" msg.cur = MSG_CTXT - elif eof or line.startswith('msgid "'): - if msg.id or msg.val[0]: - msg = self.print_msg() + elif line.startswith('msgid "'): + msg = self.print_msg() msg.id = "" msg.cur = MSG_ID + elif line.startswith('msgid 0x') or line.startswith('msgkey 0x'): + msg = self.print_msg() + msg.id = '\x01' + msg.plural_num = 0 + x = line.find('0x') + msg.key = int(line[x:], 16) + msg.cur = MSG_UNSPEC # without text data elif line.startswith('msgid_plural "'): msg.id_plural = "" msg.cur = MSG_ID_PLURAL @@ -204,16 +211,7 @@ class Lmo: msg.val.append(None) msg.val[msg.plural_num] = b'' msg.cur = MSG_STR - elif line.startswith('msgkey 0x'): - if msg.id or msg.val[0]: - msg = self.print_msg() - msg.id = '\x01' - msg.plural_num = 0 - x = line.find('0x') - msg.key = int(line[x:], 16) - return - if eof: - return + # read text data if msg.cur != MSG_UNSPEC: tmp = self.extract_string(line) if tmp is not None and len(tmp) > 0: @@ -236,8 +234,8 @@ class Lmo: with open(filename, "r", encoding='UTF-8') as file: for line in file: self.process_line(line.rstrip()) - else: - self.process_line("", eof=True) + else: + self.print_msg() # EOF def load_from_list(self, entries): self.entries = entries