working on asset still
This commit is contained in:
@@ -13,6 +13,6 @@
|
|||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char_t
|
void *n;
|
||||||
} languagechunk_t;
|
} languagechunk_t;
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
@@ -15,18 +15,53 @@ def processLanguageList():
|
|||||||
headerKeys += "#pragma once\n"
|
headerKeys += "#pragma once\n"
|
||||||
headerKeys += "#include \"dusk.h\"\n\n"
|
headerKeys += "#include \"dusk.h\"\n\n"
|
||||||
|
|
||||||
|
# This is the desired chunk groups list.. if a language key STARTS with any
|
||||||
|
# of the keys in this list we would "like to" put it in that chunk group.
|
||||||
|
# If there is no match, or the list is full then we will add it to the next
|
||||||
|
# available chunk group (that isn't a 'desired' one).
|
||||||
|
desiredChunkGroups = {
|
||||||
|
'ui': 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Now, for each language key, create the header reference and index.
|
||||||
keyIndex = 0
|
keyIndex = 0
|
||||||
|
languageKeyIndexes = {}
|
||||||
|
languageKeyChunk = {}
|
||||||
for key in LANGUAGE_KEYS:
|
for key in LANGUAGE_KEYS:
|
||||||
headerKeys += f"#define {getLanguageVariableName(key)} {keyIndex}\n"
|
headerKeys += f"#define {getLanguageVariableName(key)} {keyIndex}\n"
|
||||||
|
languageKeyIndexes[key] = keyIndex
|
||||||
keyIndex += 1
|
keyIndex += 1
|
||||||
|
|
||||||
|
# Find desired chunk group
|
||||||
|
assignedChunk = None
|
||||||
|
for desiredKey in desiredChunkGroups:
|
||||||
|
if key.lower().startswith(desiredKey):
|
||||||
|
assignedChunk = desiredChunkGroups[desiredKey]
|
||||||
|
break
|
||||||
|
# If no desired chunk group matched, assign to -1
|
||||||
|
if assignedChunk is None:
|
||||||
|
assignedChunk = -1
|
||||||
|
languageKeyChunk[key] = assignedChunk
|
||||||
|
|
||||||
|
# Setup header.
|
||||||
for lang in LANGUAGE_DATA:
|
for lang in LANGUAGE_DATA:
|
||||||
if key not in LANGUAGE_DATA[lang]:
|
if key not in LANGUAGE_DATA[lang]:
|
||||||
print(f"Warning: Missing translation for key '{key}' in language '{lang}'")
|
print(f"Warning: Missing translation for key '{key}' in language '{lang}'")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Seal the header.
|
||||||
headerKeys += f"\n#define LANG_KEY_COUNT {len(LANGUAGE_KEYS)}\n"
|
headerKeys += f"\n#define LANG_KEY_COUNT {len(LANGUAGE_KEYS)}\n"
|
||||||
|
|
||||||
|
# Now we can generate the language string chunks.
|
||||||
|
for lang in LANGUAGE_DATA:
|
||||||
|
langData = LANGUAGE_DATA[lang]
|
||||||
|
|
||||||
|
# Key = chunkIndex, value = chunkInfo
|
||||||
|
languageChunks = {}
|
||||||
|
for key in LANGUAGE_KEYS:
|
||||||
|
keyIndex = languageKeyIndexes[key]
|
||||||
|
chunkIndex = languageKeyChunk[key]
|
||||||
|
|
||||||
# Write out the language keys header file
|
# Write out the language keys header file
|
||||||
outputFile = os.path.join(args.headers_dir, "locale", "language", "keys.h")
|
outputFile = os.path.join(args.headers_dir, "locale", "language", "keys.h")
|
||||||
os.makedirs(os.path.dirname(outputFile), exist_ok=True)
|
os.makedirs(os.path.dirname(outputFile), exist_ok=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user