Node 0 MemTotal: 7863292 kB Node 0 MemFree: 1404104 kB Node 0 MemUsed: 6459188 kB Node 0 SwapCached: 7748 kB Node 0 Active: 2013704 kB Node 0 Inactive: 3315880 kB Node 0 Active(anon): 1072512 kB Node 0 Inactive(anon): 600848 kB Node 0 Active(file): 941192 kB Node 0 Inactive(file): 2715032 kB Node 0 Unevictable: 4000 kB Node 0 Mlocked: 0 kB Node 0 Dirty: 500 kB Node 0 Writeback: 0 kB Node 0 FilePages: 3746800 kB Node 0 Mapped: 227520 kB Node 0 AnonPages: 1537912 kB Node 0 Shmem: 82776 kB Node 0 KernelStack: 8816 kB Node 0 PageTables: 12308 kB Node 0 SecPageTables: 0 kB Node 0 NFS_Unstable: 0 kB Node 0 Bounce: 0 kB Node 0 WritebackTmp: 0 kB Node 0 KReclaimable: 887824 kB Node 0 Slab: 981980 kB Node 0 SReclaimable: 887824 kB Node 0 SUnreclaim: 94156 kB Node 0 AnonHugePages: 770048 kB Node 0 ShmemHugePages: 0 kB Node 0 ShmemPmdMapped: 0 kB Node 0 FileHugePages: 0 kB Node 0 FilePmdMapped: 0 kB Node 0 Unaccepted: 0 kB Node 0 HugePages_Total: 0 Node 0 HugePages_Free: 0 Node 0 HugePages_Surp: 0 #ˆl–ß=¿JJj"Tâ�rà™¸&TÅ£À ƒh¹¿Ã !ˆl–ß=¿JJj"Tâ�vãOÜ *bÑ¿Á 0ÀÄÃ: ˆl–Ãa¾”d*j"TÚ�zã@¸Ø”ţ ƒu·ÁÁa–ß=¿JJj"Tâ�vãOÜ JbѿŦ #! /usr/bin/python3.9 # Written by Martin v. Löwis """Generate binary message catalog from textual translation description. This program converts a textual Uniforum-style message catalog (.po file) into a binary GNU catalog (.mo file). This is essentially the same function as the GNU msgfmt program, however, it is a simpler implementation. Currently it does not handle plural forms but it does handle message contexts. Usage: msgfmt.py [OPTIONS] filename.po Options: -o file --output-file=file Specify the output file to write to. If omitted, output will go to a file named filename.mo (based off the input file name). -h --help Print this message and exit. -V --version Display version information and exit. """ import os import sys import ast import getopt import struct import array from email.parser import HeaderParser __version__ = "1.2" MESSAGES = {} def usage(code, msg=''): print(__doc__, file=sys.stderr) if msg: print(msg, file=sys.stderr) sys.exit(code) def add(ctxt, id, str, fuzzy): "Add a non-fuzzy translation to the dictionary." global MESSAGES if not fuzzy and str: if ctxt is None: MESSAGES[id] = str else: MESSAGES[b"%b\x04%b" % (ctxt, id)] = str def generate(): "Return the generated output." global MESSAGES # the keys are sorted in the .mo file keys = sorted(MESSAGES.keys()) offsets = [] ids = strs = b'' for id in keys: # For each string, we need size and file offset. Each string is NUL # terminated; the NUL does not count into the size. offsets.append((len(ids), len(id), len(strs), len(MESSAGES[id]))) ids += id + b'\0' strs += MESSAGES[id] + b'\0' output = '' # The header is 7 32-bit unsigned integers. We don't use hash tables, so # the keys start right after the index tables. # translated string. keystart = 7*4+16*len(keys) # and the values start after the keys valuestart = keystart + len(ids) koffsets = [] voffsets = [] # The string table first has the list of keys, then the list of values. # Each entry has first the size of the string, then the file offset. for o1, l1, o2, l2 in offsets: koffsets += [l1, o1+keystart] voffsets += [l2, o2+valuestart] offsets = koffsets + voffsets output = struct.pack("Iiiiiii", 0x950412de, # Magic 0, # Version len(keys), # # of entries