summaryrefslogtreecommitdiff
path: root/bin/inkstitch-tiles-gettext
blob: e125dabf50d041348bff72bab14c28297ccb22f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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", "")))