From d278f6a54a2a316e70271ad04bd206e49a93fa5f Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sat, 18 Feb 2023 22:24:58 -0500 Subject: add tiles json and internationalization --- bin/inkstitch-tiles-gettext | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 bin/inkstitch-tiles-gettext (limited to 'bin') diff --git a/bin/inkstitch-tiles-gettext b/bin/inkstitch-tiles-gettext new file mode 100755 index 00000000..e125dabf --- /dev/null +++ b/bin/inkstitch-tiles-gettext @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +import os +import json + +# generate fake python code containing the names and descriptions of all built- +# in tiles as gettext calls so that pybabel will extract them into messages.po + +tiles_dir = os.path.join(os.path.dirname(__file__), "..", "tiles") + +for tile in sorted(os.listdir(tiles_dir)): + with open(os.path.join(tiles_dir, tile, "tile.json")) as tile_json: + tile_metadata = json.load(tile_json) + + print("# L10N name of tile in tiles/%s" % tile) + print("_(%s)" % repr(tile_metadata.get("name", ""))) + + if tile_metadata.get("description", ""): + print("# L10N description of tile in tiles/%s" % tile) + print("_(%s)" % repr(tile_metadata.get("description", ""))) + -- cgit v1.2.3