diff options
| author | Lex Neva <github.com@lexneva.name> | 2023-02-18 22:24:58 -0500 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2023-02-20 15:27:56 -0500 |
| commit | d278f6a54a2a316e70271ad04bd206e49a93fa5f (patch) | |
| tree | 4c8058cbebec6fa21b49cfad97f4f186ff71ffd8 /bin/inkstitch-tiles-gettext | |
| parent | 315866de9ade249cab8db81d880d255f33f851f3 (diff) | |
add tiles json and internationalization
Diffstat (limited to 'bin/inkstitch-tiles-gettext')
| -rwxr-xr-x | bin/inkstitch-tiles-gettext | 21 |
1 files changed, 21 insertions, 0 deletions
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", ""))) + |
