mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Automatic discovery of i18n resources
Excluding qqq.json any .json file under static/i18n is now considered to be a i18n resource. This eliminates the need to update the i18n_resources_list.txt file every time a new language json file is added. Thus Translatewiki PRs will not require extra work.
This commit is contained in:
@ -1,2 +0,0 @@
|
||||
i18n/en.json
|
||||
i18n/hy.json
|
@ -24,17 +24,29 @@ lib_resources = custom_target('resources',
|
||||
depends: preprocessed_resources
|
||||
)
|
||||
|
||||
i18n_resource_files = run_command(find_program('python3'),
|
||||
'-c',
|
||||
'import sys; f=open(sys.argv[1]); print(f.read())',
|
||||
files('i18n_resources_list.txt')
|
||||
).stdout().strip().split('\n')
|
||||
i18n_resource_listing_script = '''import glob
|
||||
import os
|
||||
import sys
|
||||
qqq = sys.argv[1]
|
||||
d = os.path.dirname(qqq)
|
||||
r = glob.glob(d + "/*.json")
|
||||
r.remove(qqq)
|
||||
for f in r: print(f)
|
||||
'''
|
||||
|
||||
i18n_resource_listing_cmd = [
|
||||
find_program('python3'),
|
||||
'-c',
|
||||
i18n_resource_listing_script,
|
||||
files('i18n/qqq.json')
|
||||
]
|
||||
|
||||
i18n_resource_files = run_command(i18n_resource_listing_cmd).stdout().strip().split('\n')
|
||||
|
||||
i18n_resources = custom_target('i18n_resources',
|
||||
input: 'i18n_resources_list.txt',
|
||||
input: i18n_resource_files,
|
||||
output: ['libkiwix-i18n-resources.cpp'],
|
||||
command:[i18n_compiler,
|
||||
'--cxxfile', '@OUTPUT0@',
|
||||
'@INPUT@'],
|
||||
depend_files: i18n_resource_files
|
||||
)
|
||||
|
Reference in New Issue
Block a user