Skip to content

Commit b625be9

Browse files
Included i18n resources in compilation of static resources
Did it by making the kiwix-compile-resources script take multiple arguments.
1 parent 9bbb87d commit b625be9

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

scripts/kiwix-compile-resources

+7-5
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,17 @@ if __name__ == "__main__":
202202
parser.add_argument('--source_dir',
203203
help="Additional directory where to look for resources.",
204204
action='append')
205-
parser.add_argument('resource_file',
205+
parser.add_argument('resource_files', nargs='+',
206206
help='The list of resources to compile.')
207207
args = parser.parse_args()
208208

209-
base_dir = os.path.dirname(os.path.realpath(args.resource_file))
210209
source_dir = args.source_dir or []
211-
with open(args.resource_file, 'r') as f:
212-
resources = [Resource([base_dir]+source_dir, *line.strip().split())
213-
for line in f.readlines()]
210+
resources = []
211+
for resfile in args.resource_files:
212+
base_dir = os.path.dirname(os.path.realpath(resfile))
213+
with open(resfile, 'r') as f:
214+
resources += [Resource([base_dir]+source_dir, *line.strip().split())
215+
for line in f.readlines()]
214216

215217
h_identifier = to_identifier(os.path.basename(args.hfile))
216218
with open(args.hfile, 'w') as f:

scripts/kiwix-compile-resources.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.SH NAME
33
kiwix-compile-resources \- helper to compile and generate some Kiwix resources
44
.SH SYNOPSIS
5-
\fBkiwix\-compile\-resources\fR [\-h] [\-\-cxxfile CXXFILE] [\-\-hfile HFILE] resource_file\fR
5+
\fBkiwix\-compile\-resources\fR [\-h] [\-\-cxxfile CXXFILE] [\-\-hfile HFILE] resource_file ...\fR
66
.SH DESCRIPTION
77
.TP
88
resource_file

static/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ preprocessed_resources = custom_target('preprocessed_resource_files',
1414
)
1515

1616
lib_resources = custom_target('resources',
17-
input: preprocessed_resources,
17+
input: [preprocessed_resources, 'i18n_resources_list.txt'],
1818
output: ['libkiwix-resources.cpp', 'libkiwix-resources.h'],
1919
command:[res_compiler,
2020
'--cxxfile', '@OUTPUT0@',

test/server.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ const ResourceCollection resources200Uncompressible{
136136
{ STATIC_CONTENT, "/ROOT/skin/search-icon.svg?cacheid=b10ae7ed" },
137137
{ DYNAMIC_CONTENT, "/ROOT/skin/search_results.css" },
138138
{ STATIC_CONTENT, "/ROOT/skin/search_results.css?cacheid=76d39c84" },
139+
{ DYNAMIC_CONTENT, "/ROOT/skin/i18n/hy.json" },
140+
// TODO: implement cache management of i18n resources
141+
//{ STATIC_CONTENT, "/ROOT/skin/i18n/hy.json?cacheid=unknown" },
139142

140143
{ ZIM_CONTENT, "/ROOT/raw/zimfile/meta/Title" },
141144
{ ZIM_CONTENT, "/ROOT/raw/zimfile/meta/Description" },

0 commit comments

Comments
 (0)