summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2019-04-02 23:07:38 -0400
committerLex Neva <github.com@lexneva.name>2019-04-02 23:07:38 -0400
commita6a86973dd54d623394fdbfc61e6e4c0ca263cc0 (patch)
tree2d9c48e16e3d6ca82729a758815d8205d658d1da /bin
parenta9cf553066c3fd5b907593751bb00f77f32ce86a (diff)
add localization for font names and descriptions
Diffstat (limited to 'bin')
-rwxr-xr-xbin/inkstitch-fonts-gettext19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/inkstitch-fonts-gettext b/bin/inkstitch-fonts-gettext
new file mode 100755
index 00000000..8a3aa728
--- /dev/null
+++ b/bin/inkstitch-fonts-gettext
@@ -0,0 +1,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 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", "")) \ No newline at end of file