mirror of https://github.com/kiwix/libkiwix.git
Included i18n resources in compilation of static resources
Did it by making the kiwix-compile-resources script take multiple arguments.
This commit is contained in:
parent
2b01b8168f
commit
886a92a795
|
@ -202,15 +202,17 @@ if __name__ == "__main__":
|
||||||
parser.add_argument('--source_dir',
|
parser.add_argument('--source_dir',
|
||||||
help="Additional directory where to look for resources.",
|
help="Additional directory where to look for resources.",
|
||||||
action='append')
|
action='append')
|
||||||
parser.add_argument('resource_file',
|
parser.add_argument('resource_files', nargs='+',
|
||||||
help='The list of resources to compile.')
|
help='The list of resources to compile.')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
base_dir = os.path.dirname(os.path.realpath(args.resource_file))
|
|
||||||
source_dir = args.source_dir or []
|
source_dir = args.source_dir or []
|
||||||
with open(args.resource_file, 'r') as f:
|
resources = []
|
||||||
resources = [Resource([base_dir]+source_dir, *line.strip().split())
|
for resfile in args.resource_files:
|
||||||
for line in f.readlines()]
|
base_dir = os.path.dirname(os.path.realpath(resfile))
|
||||||
|
with open(resfile, 'r') as f:
|
||||||
|
resources += [Resource([base_dir]+source_dir, *line.strip().split())
|
||||||
|
for line in f.readlines()]
|
||||||
|
|
||||||
h_identifier = to_identifier(os.path.basename(args.hfile))
|
h_identifier = to_identifier(os.path.basename(args.hfile))
|
||||||
with open(args.hfile, 'w') as f:
|
with open(args.hfile, 'w') as f:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
.SH NAME
|
.SH NAME
|
||||||
kiwix-compile-resources \- helper to compile and generate some Kiwix resources
|
kiwix-compile-resources \- helper to compile and generate some Kiwix resources
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fBkiwix\-compile\-resources\fR [\-h] [\-\-cxxfile CXXFILE] [\-\-hfile HFILE] resource_file\fR
|
\fBkiwix\-compile\-resources\fR [\-h] [\-\-cxxfile CXXFILE] [\-\-hfile HFILE] resource_file ...\fR
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.TP
|
.TP
|
||||||
resource_file
|
resource_file
|
||||||
|
|
|
@ -15,7 +15,7 @@ preprocessed_resources = custom_target('preprocessed_resource_files',
|
||||||
)
|
)
|
||||||
|
|
||||||
lib_resources = custom_target('resources',
|
lib_resources = custom_target('resources',
|
||||||
input: preprocessed_resources,
|
input: [preprocessed_resources, 'i18n_resources_list.txt'],
|
||||||
output: ['libkiwix-resources.cpp', 'libkiwix-resources.h'],
|
output: ['libkiwix-resources.cpp', 'libkiwix-resources.h'],
|
||||||
command:[res_compiler,
|
command:[res_compiler,
|
||||||
'--cxxfile', '@OUTPUT0@',
|
'--cxxfile', '@OUTPUT0@',
|
||||||
|
|
|
@ -135,6 +135,9 @@ const ResourceCollection resources200Uncompressible{
|
||||||
{ STATIC_CONTENT, "/ROOT/skin/search-icon.svg?cacheid=b10ae7ed" },
|
{ STATIC_CONTENT, "/ROOT/skin/search-icon.svg?cacheid=b10ae7ed" },
|
||||||
{ DYNAMIC_CONTENT, "/ROOT/skin/search_results.css" },
|
{ DYNAMIC_CONTENT, "/ROOT/skin/search_results.css" },
|
||||||
{ STATIC_CONTENT, "/ROOT/skin/search_results.css?cacheid=76d39c84" },
|
{ STATIC_CONTENT, "/ROOT/skin/search_results.css?cacheid=76d39c84" },
|
||||||
|
{ DYNAMIC_CONTENT, "/ROOT/skin/i18n/test.json" },
|
||||||
|
// TODO: implement cache management of i18n resources
|
||||||
|
//{ STATIC_CONTENT, "/ROOT/skin/i18n/test.json?cacheid=unknown" },
|
||||||
|
|
||||||
{ ZIM_CONTENT, "/ROOT/raw/zimfile/meta/Title" },
|
{ ZIM_CONTENT, "/ROOT/raw/zimfile/meta/Title" },
|
||||||
{ ZIM_CONTENT, "/ROOT/raw/zimfile/meta/Description" },
|
{ ZIM_CONTENT, "/ROOT/raw/zimfile/meta/Description" },
|
||||||
|
|
Loading…
Reference in New Issue