From 863d3eb91e4cb9cdb4d781ae90c93d4fecba1121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Thu, 24 Sep 2015 14:23:31 +0200 Subject: Update JSON build script: include problem name translations with language index data. --- scripts/build_web_resources.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/build_web_resources.py b/scripts/build_web_resources.py index e3e6eff..f90ce24 100644 --- a/scripts/build_web_resources.py +++ b/scripts/build_web_resources.py @@ -174,8 +174,14 @@ while row: common_data['id'] = problem_id common_data['identifier'] = problem_identifier problems_map[problem_identifier] = common_data - # load and dump translations, for the problem subdirectory's problem.json - problem_data = {'id': problem_id, 'identifier': problem_identifier, 'translations': load_translation_data(problem_package, problem_props)} + # load translations, and copy only problem names to the common data + problem_translations = load_translation_data(problem_package, problem_props) + name_translations = {} + for key, value in problem_translations.items(): + name_translations[key] = {'name': value.get('name')} + common_data['translations'] = name_translations + # dump translations, for the problem subdirectory's problem.json + problem_data = {'id': problem_id, 'identifier': problem_identifier, 'translations': problem_translations} problem_output_path = os.path.join(group_output_path, problem_identifier) if not os.path.exists(problem_output_path): os.mkdir(problem_output_path) -- cgit v1.2.1