mirror of https://github.com/kiwix/libkiwix.git
Do not auto discover i18n files.
Revert to the plain old 'i18n_resources_list.txt' file.
Auto discovering of i18n file has a main flaw (and a small bug):
- The main flaw is that rerun the configure will not detect new
translation files. It means that if we use cache in our CI,
new translation will not be included.
- The bug is that on Windows, meson fails with a error about a non existent
`` (empty) file name. I suppose it is because python replace
`\n` by `\r\n` on Windows, and the the `.strip().split('\n')` keeps empty
lines.
The small bug could be fixed, but the main flaw make the whole better if
we use a script to generate the listing.
This commit is somehow a half revert of 2eff5b55a6
This commit is contained in:
parent
5fb919e73e
commit
6e93bad565
|
@ -0,0 +1,2 @@
|
||||||
|
i18n/en.json
|
||||||
|
i18n/hy.json
|
|
@ -24,24 +24,17 @@ lib_resources = custom_target('resources',
|
||||||
depends: preprocessed_resources
|
depends: preprocessed_resources
|
||||||
)
|
)
|
||||||
|
|
||||||
i18n_resource_listing_script = '''import glob
|
# This could be replaced with
|
||||||
import os
|
# ```
|
||||||
import sys
|
# fs = import('fs')
|
||||||
qqq = sys.argv[1]
|
# i18n_resource_files = fs.read('i18n_resources_list.txt').strip().split('\n')
|
||||||
d = os.path.dirname(qqq)
|
# ```
|
||||||
r = glob.glob(d + "/*.json")
|
# once we move to meson >= 0.57.0
|
||||||
r.remove(qqq)
|
i18n_resource_files = run_command(find_program('python3'),
|
||||||
for f in r: print(f)
|
|
||||||
'''
|
|
||||||
|
|
||||||
i18n_resource_listing_cmd = [
|
|
||||||
find_program('python3'),
|
|
||||||
'-c',
|
'-c',
|
||||||
i18n_resource_listing_script,
|
'import sys; f=open(sys.argv[1]); print(f.read())',
|
||||||
files('i18n/qqq.json')
|
files('i18n_resources_list.txt')
|
||||||
]
|
).stdout().strip().split('\n')
|
||||||
|
|
||||||
i18n_resource_files = run_command(i18n_resource_listing_cmd).stdout().strip().split('\n')
|
|
||||||
|
|
||||||
i18n_resources = custom_target('i18n_resources',
|
i18n_resources = custom_target('i18n_resources',
|
||||||
input: i18n_resource_files,
|
input: i18n_resource_files,
|
||||||
|
|
Loading…
Reference in New Issue