summaryrefslogtreecommitdiff
path: root/po
diff options
context:
space:
mode:
Diffstat (limited to 'po')
-rwxr-xr-xpo/compile.py48
-rw-r--r--po/en.po4
2 files changed, 37 insertions, 15 deletions
diff --git a/po/compile.py b/po/compile.py
index cfe837ea..6416ea0e 100755
--- a/po/compile.py
+++ b/po/compile.py
@@ -38,29 +38,46 @@ def unquote(string):
38 38
39def parse_po(src): 39def parse_po(src):
40 messages = [] 40 messages = []
41 is_multi = False 41 is_multi = False # string is multiple lines
42 msg_id, msg_str = None, None 42 is_plural = False
43 msg_id, msg_str, msg_index = None, None, None
43 for line in open(src, 'rt', encoding='utf-8').readlines(): 44 for line in open(src, 'rt', encoding='utf-8').readlines():
44 line = line.strip() 45 line = line.strip()
45 if is_multi: 46 if is_multi:
46 if len(line) == 0: 47 if len(line) == 0 or line[0] != '"':
47 if msg_id: 48 if msg_id:
48 messages.append((msg_id, msg_str)) 49 messages.append((msg_id, msg_str, msg_index))
49 is_multi = False 50 is_multi = False
50 continue
51 else: 51 else:
52 msg_str += unquote(line) 52 msg_str += unquote(line)
53 if line.startswith('msgid'): 53 if line.startswith('msgid_plural'):
54 msg_id = unquote(line[12:])
55 is_plural = True
56 elif line.startswith('msgid'):
54 msg_id = unquote(line[6:]) 57 msg_id = unquote(line[6:])
55 elif line == 'msgstr ""': 58 is_plural = False
56 # Multiline string. 59 elif line.startswith('msgstr'):
57 is_multi = True 60 if line[6] == '[':
58 msg_str = '' 61 msg_index = int(line[7])
59 elif line.startswith('msgstr'): 62 line = line[9:]
60 msg_str = unquote(line[7:]) 63 else:
61 if msg_id: 64 msg_index = None
62 messages.append((msg_id, msg_str)) 65 line = line[6:]
63 return messages 66 if line.endswith(' ""'):
67 is_multi = True
68 msg_str = ''
69 else:
70 msg_str = unquote(line)
71 if msg_id:
72 messages.append((msg_id, msg_str, msg_index))
73 # Apply plural indices to ids.
74 pluralized = []
75 for msg_id, msg_str, msg_index in messages:
76 if not msg_index is None:
77 msg_id = f'{msg_id[:-1]}{msg_index}'
78 pluralized.append((msg_id, msg_str))
79 #print(msg_id, '=>', msg_str)
80 return pluralized
64 81
65 82
66if MODE == 'compile': 83if MODE == 'compile':
@@ -76,6 +93,7 @@ if MODE == 'compile':
76elif MODE == 'new': 93elif MODE == 'new':
77 messages = parse_po('en.po') 94 messages = parse_po('en.po')
78 f = open('new.po', 'wt', encoding='utf-8') 95 f = open('new.po', 'wt', encoding='utf-8')
96 # TODO: plurals
79 for msg_id, _ in messages: 97 for msg_id, _ in messages:
80 print(f'\nmsgid "{msg_id}"\nmsgstr ""\n', file=f) 98 print(f'\nmsgid "{msg_id}"\nmsgstr ""\n', file=f)
81 99
diff --git a/po/en.po b/po/en.po
index 36f30eda..c580d059 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1,3 +1,4 @@
1# Alt-text of the preformatted logo.
1msgid "about.logo" 2msgid "about.logo"
2msgstr "ASCII art: the word \"Lagrange\" using a large font" 3msgstr "ASCII art: the word \"Lagrange\" using a large font"
3 4
@@ -73,9 +74,11 @@ msgstr "Find on Page"
73msgid "macos.menu.find" 74msgid "macos.menu.find"
74msgstr "Find" 75msgstr "Find"
75 76
77# Used on iOS. "Files" refers to Apple's iOS app where you can pick an iCloud folder.
76msgid "menu.save.files" 78msgid "menu.save.files"
77msgstr "Save to Files" 79msgstr "Save to Files"
78 80
81# Used on desktop operating systems. "Downloads" refers to the user's configured downloads directory.
79msgid "menu.save.downloads" 82msgid "menu.save.downloads"
80msgstr "Save to Downloads" 83msgstr "Save to Downloads"
81 84
@@ -241,6 +244,7 @@ msgstr "Identities"
241msgid "sidebar.outline" 244msgid "sidebar.outline"
242msgstr "Outline" 245msgstr "Outline"
243 246
247# Usage: "(count) Unread" in the sidebar tab title, referring to feed entries.
244msgid "sidebar.unread" 248msgid "sidebar.unread"
245msgid_plural "sidebar.unread.n" 249msgid_plural "sidebar.unread.n"
246msgstr[0] "Unread" 250msgstr[0] "Unread"