Renamed json dir, added another key to the output
This commit is contained in:
@@ -9,7 +9,7 @@ This repository contains documentation and some developer resources for the
|
|||||||
|
|
||||||
Some items of interest are:
|
Some items of interest are:
|
||||||
|
|
||||||
- [JSON-formatted UCS Schedules](ucs_json) for all the available languages.
|
- [JSON-formatted UCS Schedules](json/) for all the available languages.
|
||||||
- The [tool](tools/ucsxls2json.py) used to make these JSON files from the
|
- The [tool](tools/ucsxls2json.py) used to make these JSON files from the
|
||||||
original XLS file.
|
original XLS file.
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,9 @@ UCS_VERSION = "8.2.1"
|
|||||||
# This is the file to pull descriptions from
|
# This is the file to pull descriptions from
|
||||||
EXCEL_FILE = 'UCS v8.2.1 Full Translations.xlsx'
|
EXCEL_FILE = 'UCS v8.2.1 Full Translations.xlsx'
|
||||||
|
|
||||||
|
# Output directory, where all the output files will be written
|
||||||
|
OUTPUT_DIR = 'json'
|
||||||
|
|
||||||
data = pd.read_excel(EXCEL_FILE)
|
data = pd.read_excel(EXCEL_FILE)
|
||||||
|
|
||||||
# Create a table of all languages that maps language-column pairs to their
|
# Create a table of all languages that maps language-column pairs to their
|
||||||
@@ -44,7 +47,7 @@ for i, (col_index, col_data) in enumerate(data.T.iterrows()):
|
|||||||
|
|
||||||
langs[components[1]][i] = components[0]
|
langs[components[1]][i] = components[0]
|
||||||
|
|
||||||
os.makedirs("ucs_json", exist_ok=True)
|
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
||||||
|
|
||||||
# Pull the rows into a list
|
# Pull the rows into a list
|
||||||
# skip the first three rows of the data, it's just header material
|
# skip the first three rows of the data, it's just header material
|
||||||
@@ -64,9 +67,11 @@ for lang in langs:
|
|||||||
for col_index in langs[lang]:
|
for col_index in langs[lang]:
|
||||||
key_name = langs[lang][col_index]
|
key_name = langs[lang][col_index]
|
||||||
category[key_name] = row.iloc[col_index]
|
category[key_name] = row.iloc[col_index]
|
||||||
|
# Save the English CatID so this can be cross-referenced
|
||||||
|
category['CatID'] = row.iloc[2]
|
||||||
|
|
||||||
schedule.append(category)
|
schedule.append(category)
|
||||||
|
|
||||||
# and dump it to json
|
# and dump it to json
|
||||||
with open(f"ucs_json/{lang}.json", "w") as fp:
|
with open(f"{OUTPUT_DIR}/{lang}.json", "w") as fp:
|
||||||
json.dump(schedule, indent=True, fp=fp)
|
json.dump(schedule, indent=True, fp=fp)
|
||||||
|
Reference in New Issue
Block a user