mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Change TranslationStrings to pointer
This commit is contained in:
@@ -528,7 +528,7 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
|||||||
str_offsets = []
|
str_offsets = []
|
||||||
offset = 0
|
offset = 0
|
||||||
write_null = False
|
write_null = False
|
||||||
f.write("const char TranslationStrings[] = {\n")
|
f.write("const char TranslationStringsData[] = {\n")
|
||||||
for i, source_str in enumerate(str_table):
|
for i, source_str in enumerate(str_table):
|
||||||
if write_null:
|
if write_null:
|
||||||
f.write(' "\\0"\n')
|
f.write(' "\\0"\n')
|
||||||
@@ -567,7 +567,7 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
|||||||
assert str_offsets[idx] >= 0
|
assert str_offsets[idx] >= 0
|
||||||
return str_offsets[idx]
|
return str_offsets[idx]
|
||||||
|
|
||||||
f.write("static const TranslationIndexTable TranslationIndices = {\n")
|
f.write("const TranslationIndexTable TranslationIndices = {\n")
|
||||||
|
|
||||||
# ----- Write the messages string indices:
|
# ----- Write the messages string indices:
|
||||||
for group in [str_group_messages, str_group_messageswarn, str_group_characters]:
|
for group in [str_group_messages, str_group_messageswarn, str_group_characters]:
|
||||||
@@ -593,7 +593,8 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
|||||||
f.write(f" }}, // {name}\n\n")
|
f.write(f" }}, // {name}\n\n")
|
||||||
|
|
||||||
f.write("}; // TranslationIndices\n\n")
|
f.write("}; // TranslationIndices\n\n")
|
||||||
f.write("const TranslationIndexTable *const Tr = &TranslationIndices;\n\n")
|
f.write("const TranslationIndexTable *const Tr = &TranslationIndices;\n")
|
||||||
|
f.write("const char *const TranslationStrings = TranslationStringsData;\n\n")
|
||||||
|
|
||||||
f.write(
|
f.write(
|
||||||
f"const bool HasFahrenheit = {('true' if lang.get('tempUnitFahrenheit', True) else 'false')};\n"
|
f"const bool HasFahrenheit = {('true' if lang.get('tempUnitFahrenheit', True) else 'false')};\n"
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ enum class SettingsItemIndex : uint8_t {
|
|||||||
NUM_ITEMS,
|
NUM_ITEMS,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const char TranslationStrings[];
|
|
||||||
|
|
||||||
struct TranslationIndexTable {
|
struct TranslationIndexTable {
|
||||||
uint16_t SettingsCalibrationWarning;
|
uint16_t SettingsCalibrationWarning;
|
||||||
uint16_t SettingsResetWarning;
|
uint16_t SettingsResetWarning;
|
||||||
@@ -114,6 +112,7 @@ struct TranslationIndexTable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern const TranslationIndexTable *const Tr;
|
extern const TranslationIndexTable *const Tr;
|
||||||
|
extern const char *const TranslationStrings;
|
||||||
|
|
||||||
constexpr uint8_t settings_item_index(const SettingsItemIndex i) { return static_cast<uint8_t>(i); }
|
constexpr uint8_t settings_item_index(const SettingsItemIndex i) { return static_cast<uint8_t>(i); }
|
||||||
// Use a constexpr function for type-checking.
|
// Use a constexpr function for type-checking.
|
||||||
|
|||||||
Reference in New Issue
Block a user