summaryrefslogtreecommitdiff
path: root/bin/inkstitch-fonts-gettext
blob: 24fb9fdf5b62493852731a0d11d90da02004629d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python

import os
import json

# generate fake python code containing the names and descriptions of all built-
# in fonts as gettext calls so that pybabel will extract them into messages.po

fonts_dir = os.path.join(os.path.dirname(__file__), "..", "fonts")

for font in sorted(os.listdir(fonts_dir)):
	with open(os.path.join(fonts_dir, font, "font.json")) as font_json:
		font_metadata = json.load(font_json)
		
		print("# L10N name of font in fonts/%s" % font)
		print("_(%s)" % repr(font_metadata.get("name", "")))
		
		print("# L10N description of font in fonts/%s" % font)
		print("_(%s)" % repr(font_metadata.get("description", "")))