forked from xry111/lfs-book-i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangelogtranslator.py
More file actions
executable file
·30 lines (25 loc) · 1.4 KB
/
changelogtranslator.py
File metadata and controls
executable file
·30 lines (25 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import re
from templatetranslator import TemplateTranslator
languages = sys.argv
languages.pop(0)
files=['chapter01/changelog.po']
tt = TemplateTranslator(files)
tt.append(re.compile('\[([^\]]+)\] - Updated? to ([^ ]+). +Fixes (<ulink [^>]+> *#[0-9]+ *</ulink>).?$', re.MULTILINE|re.DOTALL),
{'fr': '[#1] — Mise à jour vers #2. Corrige #3',
'zh_CN': '[#1] — 更新到 #2。修复 #3。'})
tt.append(re.compile('\[([^\]]+)\] - Updated? to ([^ ]+). +Partially fixes (<ulink [^>]+> *#[0-9]+ *</ulink>).?$', re.MULTILINE|re.DOTALL),
{'fr': '[#1] — Mise à jour vers #2. Corrige partiellement #3',
'zh_CN': '[#1] — 更新到 #2。部分修复 #3。'})
tt.append(re.compile('\[([^\]]+)\] - Updated? to ([^ ]+) (\([^ ]+\)). +Fixes (<ulink [^>]+> *#[0-9]+ *</ulink>).?$', re.MULTILINE|re.DOTALL),
{'fr': '[#1] — Mise à jour vers #2 #3. Corrige #4',
'zh_CN': '[#1] — 更新到 #2 #3。修复#4。'})
tt.append(re.compile('\[([^\]]+)\] - Updated? to ([^ ]+) \(([^ ]+) module\). +Fixes (<ulink [^>]+> *#[0-9]+ *</ulink>).?$', re.MULTILINE|re.DOTALL),
{'fr': '[#1] — Mise à jour vers #2 (module #3). Corrige #4',
'zh_CN': '[#1] — 更新到 #2 (模块 #3)。修复 #4。'})
tt.append(re.compile('(20[0-9]{2})-(0?)([0-9]+)-(0?)([0-9]+)'),
{'fr': '#4#5-#2#3-#1',
'zh_CN': '#1 年 #3 月 #5 日'})
tt.translate(languages)