Change translation strs to be stored in one block
This commit is contained in:
@@ -12,6 +12,7 @@ from datetime import datetime
|
||||
from itertools import chain
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, TextIO, Tuple, Union
|
||||
from dataclasses import dataclass
|
||||
|
||||
from bdflib import reader as bdfreader
|
||||
from bdflib.model import Font, Glyph
|
||||
@@ -377,6 +378,16 @@ def convert_string(symbol_conversion_table: Dict[str, str], text: str) -> str:
|
||||
return output_string
|
||||
|
||||
|
||||
def escape(string: str) -> str:
|
||||
return json.dumps(string, ensure_ascii=False)
|
||||
|
||||
|
||||
@dataclass
|
||||
class TranslationItem:
|
||||
info: str
|
||||
str_index: int
|
||||
|
||||
|
||||
def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
||||
language_code: str = lang["languageCode"]
|
||||
logging.info(f"Generating block for {language_code}")
|
||||
@@ -394,28 +405,26 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
||||
f.write(font_table_text)
|
||||
f.write(f"\n// ---- {lang_name} ----\n\n")
|
||||
|
||||
# ----- Writing SettingsDescriptions
|
||||
str_table: List[str] = []
|
||||
str_group_messages: List[TranslationItem] = []
|
||||
str_group_messageswarn: List[TranslationItem] = []
|
||||
str_group_characters: List[TranslationItem] = []
|
||||
str_group_settingdesc: List[TranslationItem] = []
|
||||
str_group_settingshortnames: List[TranslationItem] = []
|
||||
str_group_settingmenuentries: List[TranslationItem] = []
|
||||
str_group_settingmenuentriesdesc: List[TranslationItem] = []
|
||||
|
||||
# ----- Reading SettingsDescriptions
|
||||
obj = lang["menuOptions"]
|
||||
f.write("const char* SettingsDescriptions[] = {\n")
|
||||
|
||||
max_len = 25
|
||||
index = 0
|
||||
for mod in defs["menuOptions"]:
|
||||
for index, mod in enumerate(defs["menuOptions"]):
|
||||
eid = mod["id"]
|
||||
if "feature" in mod:
|
||||
f.write(f"#ifdef {mod['feature']}\n")
|
||||
f.write(f" /* [{index:02d}] {eid.ljust(max_len)[:max_len]} */ ")
|
||||
f.write(
|
||||
f"\"{convert_string(symbol_conversion_table, obj[eid]['desc'])}\",//{obj[eid]['desc']} \n"
|
||||
str_group_settingdesc.append(
|
||||
TranslationItem(f"[{index:02d}] {eid}", len(str_table))
|
||||
)
|
||||
str_table.append(obj[eid]["desc"])
|
||||
|
||||
if "feature" in mod:
|
||||
f.write("#endif\n")
|
||||
index += 1
|
||||
|
||||
f.write("};\n\n")
|
||||
|
||||
# ----- Writing Message strings
|
||||
# ----- Reading Message strings
|
||||
|
||||
obj = lang["messages"]
|
||||
|
||||
@@ -426,11 +435,8 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
||||
source_text = mod["default"]
|
||||
if eid in obj:
|
||||
source_text = obj[eid]
|
||||
translated_text = convert_string(symbol_conversion_table, source_text)
|
||||
source_text = source_text.replace("\n", "_")
|
||||
f.write(f'const char* {eid} = "{translated_text}";//{source_text} \n')
|
||||
|
||||
f.write("\n")
|
||||
str_group_messages.append(TranslationItem(eid, len(str_table)))
|
||||
str_table.append(source_text)
|
||||
|
||||
obj = lang["messagesWarn"]
|
||||
|
||||
@@ -443,22 +449,17 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
||||
source_text = obj[eid][0] + "\n" + obj[eid][1]
|
||||
else:
|
||||
source_text = "\n" + obj[eid]
|
||||
translated_text = convert_string(symbol_conversion_table, source_text)
|
||||
source_text = source_text.replace("\n", "_")
|
||||
f.write(f'const char* {eid} = "{translated_text}";//{source_text} \n')
|
||||
str_group_messageswarn.append(TranslationItem(eid, len(str_table)))
|
||||
str_table.append(source_text)
|
||||
|
||||
f.write("\n")
|
||||
|
||||
# ----- Writing Characters
|
||||
# ----- Reading Characters
|
||||
|
||||
obj = lang["characters"]
|
||||
|
||||
for mod in defs["characters"]:
|
||||
eid: str = mod["id"]
|
||||
f.write(
|
||||
f'const char* {eid} = "{convert_string(symbol_conversion_table, obj[eid])}";//{obj[eid]} \n'
|
||||
)
|
||||
f.write("\n")
|
||||
str_group_characters.append(TranslationItem(eid, len(str_table)))
|
||||
str_table.append(obj[eid])
|
||||
|
||||
# Write out firmware constant options
|
||||
constants = get_constants()
|
||||
@@ -475,13 +476,10 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
||||
f.write(f'\t "{convert_string(symbol_conversion_table, c)}",//{c} \n')
|
||||
f.write("};\n\n")
|
||||
|
||||
# ----- Writing SettingsDescriptions
|
||||
# ----- Reading SettingsDescriptions
|
||||
obj = lang["menuOptions"]
|
||||
f.write("const char* SettingsShortNames[] = {\n")
|
||||
|
||||
max_len = 25
|
||||
index = 0
|
||||
for mod in defs["menuOptions"]:
|
||||
for index, mod in enumerate(defs["menuOptions"]):
|
||||
eid = mod["id"]
|
||||
if isinstance(obj[eid]["text2"], list):
|
||||
if not obj[eid]["text2"][1]:
|
||||
@@ -490,25 +488,15 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
||||
source_text = obj[eid]["text2"][0] + "\n" + obj[eid]["text2"][1]
|
||||
else:
|
||||
source_text = "\n" + obj[eid]["text2"]
|
||||
if "feature" in mod:
|
||||
f.write(f"#ifdef {mod['feature']}\n")
|
||||
f.write(f" /* [{index:02d}] {eid.ljust(max_len)[:max_len]} */ ")
|
||||
f.write(
|
||||
f'{{ "{convert_string(symbol_conversion_table, source_text)}" }},//{obj[eid]["text2"]} \n'
|
||||
str_group_settingshortnames.append(
|
||||
TranslationItem(f"[{index:02d}] {eid}", len(str_table))
|
||||
)
|
||||
str_table.append(source_text)
|
||||
|
||||
if "feature" in mod:
|
||||
f.write("#endif\n")
|
||||
index += 1
|
||||
|
||||
f.write("};\n\n")
|
||||
|
||||
# ----- Writing Menu Groups
|
||||
# ----- Reading Menu Groups
|
||||
obj = lang["menuGroups"]
|
||||
f.write(f"const char* SettingsMenuEntries[{len(obj)}] = {{\n")
|
||||
|
||||
max_len = 25
|
||||
for mod in defs["menuGroups"]:
|
||||
for index, mod in enumerate(defs["menuGroups"]):
|
||||
eid = mod["id"]
|
||||
if isinstance(obj[eid]["text2"], list):
|
||||
if not obj[eid]["text2"][1]:
|
||||
@@ -517,26 +505,91 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
|
||||
source_text = obj[eid]["text2"][0] + "\n" + obj[eid]["text2"][1]
|
||||
else:
|
||||
source_text = "\n" + obj[eid]["text2"]
|
||||
f.write(f" /* {eid.ljust(max_len)[:max_len]} */ ")
|
||||
f.write(
|
||||
f'"{convert_string(symbol_conversion_table, source_text)}",//{obj[eid]["text2"]} \n'
|
||||
str_group_settingmenuentries.append(
|
||||
TranslationItem(f"[{index:02d}] {eid}", len(str_table))
|
||||
)
|
||||
str_table.append(source_text)
|
||||
|
||||
f.write("};\n\n")
|
||||
|
||||
# ----- Writing Menu Groups Descriptions
|
||||
# ----- Reading Menu Groups Descriptions
|
||||
obj = lang["menuGroups"]
|
||||
f.write(f"const char* SettingsMenuEntriesDescriptions[{(len(obj))}] = {{\n")
|
||||
|
||||
max_len = 25
|
||||
for mod in defs["menuGroups"]:
|
||||
for index, mod in enumerate(defs["menuGroups"]):
|
||||
eid = mod["id"]
|
||||
f.write(f" /* {eid.ljust(max_len)[:max_len]} */ ")
|
||||
f.write(
|
||||
f"\"{convert_string(symbol_conversion_table, (obj[eid]['desc']))}\",//{obj[eid]['desc']} \n"
|
||||
str_group_settingmenuentriesdesc.append(
|
||||
TranslationItem(f"[{index:02d}] {eid}", len(str_table))
|
||||
)
|
||||
str_table.append(obj[eid]["desc"])
|
||||
|
||||
f.write("\n")
|
||||
|
||||
# TODO: De-duplicate the strings in str_table.
|
||||
|
||||
# ----- Write the string table:
|
||||
str_offsets = []
|
||||
offset = 0
|
||||
write_null = False
|
||||
f.write("const char TranslationStrings[] = {\n")
|
||||
for i, source_str in enumerate(str_table):
|
||||
if write_null:
|
||||
f.write(' "\\0"\n')
|
||||
write_null = True
|
||||
# Find what items use this string
|
||||
is_used = False
|
||||
for group, pre_info in [
|
||||
(str_group_messages, "messages"),
|
||||
(str_group_messageswarn, "messagesWarn"),
|
||||
(str_group_characters, "characters"),
|
||||
(str_group_settingdesc, "SettingsDescriptions"),
|
||||
(str_group_settingshortnames, "SettingsShortNames"),
|
||||
(str_group_settingmenuentries, "SettingsMenuEntries"),
|
||||
(str_group_settingmenuentriesdesc, "SettingsMenuEntriesDescriptions"),
|
||||
]:
|
||||
for item in group:
|
||||
if item.str_index == i:
|
||||
is_used = True
|
||||
f.write(f" // - {pre_info} {item.info}\n")
|
||||
if not is_used:
|
||||
str_offsets.append(-1)
|
||||
write_null = False
|
||||
continue
|
||||
f.write(f" // {offset: >4}: {escape(source_str)}\n")
|
||||
converted_str = convert_string(symbol_conversion_table, source_str)
|
||||
f.write(f' "{converted_str}"')
|
||||
str_offsets.append(offset)
|
||||
# Sanity check: Each "char" in `converted_str` should be in format
|
||||
# `\xFF`, so the length should be divisible by 4.
|
||||
assert len(converted_str) % 4 == 0
|
||||
# Add the length and the null terminator
|
||||
offset += len(converted_str) // 4 + 1
|
||||
f.write("\n};\n\n")
|
||||
|
||||
def get_offset(idx: int) -> int:
|
||||
assert str_offsets[idx] >= 0
|
||||
return str_offsets[idx]
|
||||
|
||||
# ----- Write the messages string indices:
|
||||
for group in [str_group_messages, str_group_messageswarn, str_group_characters]:
|
||||
for item in group:
|
||||
f.write(
|
||||
f"const uint16_t {item.info} = {get_offset(item.str_index)}; // {escape(str_table[item.str_index])}\n"
|
||||
)
|
||||
f.write("\n")
|
||||
|
||||
# ----- Write the settings index tables:
|
||||
for group, name in [
|
||||
(str_group_settingdesc, "SettingsDescriptions"),
|
||||
(str_group_settingshortnames, "SettingsShortNames"),
|
||||
(str_group_settingmenuentries, "SettingsMenuEntries"),
|
||||
(str_group_settingmenuentriesdesc, "SettingsMenuEntriesDescriptions"),
|
||||
]:
|
||||
max_len = 30
|
||||
f.write(f"const uint16_t {name}[] = {{\n")
|
||||
for item in group:
|
||||
f.write(
|
||||
f" /* {item.info.ljust(max_len)[:max_len]} */ {get_offset(item.str_index)}, // {escape(str_table[item.str_index])}\n"
|
||||
)
|
||||
f.write(f"}}; // {name}\n\n")
|
||||
|
||||
f.write("};\n\n")
|
||||
f.write(
|
||||
f"const bool HasFahrenheit = {('true' if lang.get('tempUnitFahrenheit', True) else 'false')};\n"
|
||||
)
|
||||
|
||||
@@ -12,53 +12,55 @@ extern const uint8_t USER_FONT_12[];
|
||||
extern const uint8_t USER_FONT_6x8[];
|
||||
extern const bool HasFahrenheit;
|
||||
|
||||
extern const char *SettingsShortNames[];
|
||||
extern const char *SettingsDescriptions[];
|
||||
extern const char *SettingsMenuEntries[];
|
||||
extern const char TranslationStrings[];
|
||||
|
||||
extern const char *SettingsCalibrationWarning;
|
||||
extern const char *SettingsResetWarning;
|
||||
extern const char *UVLOWarningString;
|
||||
extern const char *UndervoltageString;
|
||||
extern const char *InputVoltageString;
|
||||
extern const uint16_t SettingsShortNames[];
|
||||
extern const uint16_t SettingsDescriptions[];
|
||||
extern const uint16_t SettingsMenuEntries[];
|
||||
|
||||
extern const char *SleepingSimpleString;
|
||||
extern const char *SleepingAdvancedString;
|
||||
extern const char *SleepingTipAdvancedString;
|
||||
extern const char *IdleTipString;
|
||||
extern const char *IdleSetString;
|
||||
extern const char *TipDisconnectedString;
|
||||
extern const char *SolderingAdvancedPowerPrompt;
|
||||
extern const char *OffString;
|
||||
extern const uint16_t SettingsCalibrationWarning;
|
||||
extern const uint16_t SettingsResetWarning;
|
||||
extern const uint16_t UVLOWarningString;
|
||||
extern const uint16_t UndervoltageString;
|
||||
extern const uint16_t InputVoltageString;
|
||||
|
||||
extern const char *ResetOKMessage;
|
||||
extern const char *SettingsResetMessage;
|
||||
extern const char *NoAccelerometerMessage;
|
||||
extern const char *NoPowerDeliveryMessage;
|
||||
extern const char *LockingKeysString;
|
||||
extern const char *UnlockingKeysString;
|
||||
extern const char *WarningKeysLockedString;
|
||||
extern const uint16_t SleepingSimpleString;
|
||||
extern const uint16_t SleepingAdvancedString;
|
||||
extern const uint16_t SleepingTipAdvancedString;
|
||||
extern const uint16_t IdleTipString;
|
||||
extern const uint16_t IdleSetString;
|
||||
extern const uint16_t TipDisconnectedString;
|
||||
extern const uint16_t SolderingAdvancedPowerPrompt;
|
||||
extern const uint16_t OffString;
|
||||
|
||||
extern const char *SettingRightChar;
|
||||
extern const char *SettingLeftChar;
|
||||
extern const char *SettingAutoChar;
|
||||
extern const char *SettingStartSolderingChar;
|
||||
extern const char *SettingStartSleepChar;
|
||||
extern const char *SettingStartSleepOffChar;
|
||||
extern const char *SettingStartNoneChar;
|
||||
extern const char *SettingSensitivityOff;
|
||||
extern const char *SettingSensitivityLow;
|
||||
extern const char *SettingSensitivityMedium;
|
||||
extern const char *SettingSensitivityHigh;
|
||||
extern const char *SettingLockDisableChar;
|
||||
extern const char *SettingLockBoostChar;
|
||||
extern const char *SettingLockFullChar;
|
||||
extern const char *SettingNAChar;
|
||||
extern const uint16_t ResetOKMessage;
|
||||
extern const uint16_t SettingsResetMessage;
|
||||
extern const uint16_t NoAccelerometerMessage;
|
||||
extern const uint16_t NoPowerDeliveryMessage;
|
||||
extern const uint16_t LockingKeysString;
|
||||
extern const uint16_t UnlockingKeysString;
|
||||
extern const uint16_t WarningKeysLockedString;
|
||||
|
||||
extern const char *SettingOffChar;
|
||||
extern const char *SettingFastChar;
|
||||
extern const char *SettingMediumChar;
|
||||
extern const char *SettingSlowChar;
|
||||
extern const uint16_t SettingRightChar;
|
||||
extern const uint16_t SettingLeftChar;
|
||||
extern const uint16_t SettingAutoChar;
|
||||
extern const uint16_t SettingStartSolderingChar;
|
||||
extern const uint16_t SettingStartSleepChar;
|
||||
extern const uint16_t SettingStartSleepOffChar;
|
||||
extern const uint16_t SettingStartNoneChar;
|
||||
extern const uint16_t SettingSensitivityOff;
|
||||
extern const uint16_t SettingSensitivityLow;
|
||||
extern const uint16_t SettingSensitivityMedium;
|
||||
extern const uint16_t SettingSensitivityHigh;
|
||||
extern const uint16_t SettingLockDisableChar;
|
||||
extern const uint16_t SettingLockBoostChar;
|
||||
extern const uint16_t SettingLockFullChar;
|
||||
extern const uint16_t SettingNAChar;
|
||||
|
||||
extern const uint16_t SettingOffChar;
|
||||
extern const uint16_t SettingFastChar;
|
||||
extern const uint16_t SettingMediumChar;
|
||||
extern const uint16_t SettingSlowChar;
|
||||
|
||||
extern const char *SymbolPlus;
|
||||
extern const char *SymbolMinus;
|
||||
@@ -112,4 +114,6 @@ constexpr uint8_t settings_item_index(const SettingsItemIndex i) { return static
|
||||
// Use a constexpr function for type-checking.
|
||||
#define SETTINGS_DESC(i) (settings_item_index(i) + 1)
|
||||
|
||||
const char *translatedString(uint16_t index);
|
||||
|
||||
#endif /* TRANSLATION_H_ */
|
||||
|
||||
3
source/Core/Src/Translation.cpp
Normal file
3
source/Core/Src/Translation.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "Translation.h"
|
||||
|
||||
const char *translatedString(uint16_t offset) { return TranslationStrings + offset; }
|
||||
@@ -247,7 +247,7 @@ const menuitem advancedMenu[] = {
|
||||
static void printShortDescription(SettingsItemIndex settingsItemIndex, uint16_t cursorCharPosition) {
|
||||
// print short description (default single line, explicit double line)
|
||||
uint8_t shortDescIndex = static_cast<uint8_t>(settingsItemIndex);
|
||||
OLED::printWholeScreen(SettingsShortNames[shortDescIndex]);
|
||||
OLED::printWholeScreen(translatedString(SettingsShortNames[shortDescIndex]));
|
||||
|
||||
// prepare cursor for value
|
||||
// make room for scroll indicator
|
||||
@@ -362,7 +362,7 @@ static bool settings_displayInputMinVRange(void) {
|
||||
OLED::printNumber(systemSettings.minVoltageCells % 10, 1, FontStyle::LARGE);
|
||||
} else {
|
||||
printShortDescription(SettingsItemIndex::MinVolCell, 5);
|
||||
OLED::print(SettingNAChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingNAChar), FontStyle::LARGE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -437,7 +437,7 @@ static bool settings_setSleepTime(void) {
|
||||
static bool settings_displaySleepTime(void) {
|
||||
printShortDescription(SettingsItemIndex::SleepTimeout, 5);
|
||||
if (systemSettings.SleepTime == 0) {
|
||||
OLED::print(OffString, FontStyle::LARGE);
|
||||
OLED::print(translatedString(OffString), FontStyle::LARGE);
|
||||
} else if (systemSettings.SleepTime < 6) {
|
||||
OLED::printNumber(systemSettings.SleepTime * 10, 2, FontStyle::LARGE);
|
||||
OLED::print(SymbolSeconds, FontStyle::LARGE);
|
||||
@@ -461,7 +461,7 @@ static bool settings_setShutdownTime(void) {
|
||||
static bool settings_displayShutdownTime(void) {
|
||||
printShortDescription(SettingsItemIndex::ShutdownTimeout, 5);
|
||||
if (systemSettings.ShutdownTime == 0) {
|
||||
OLED::print(OffString, FontStyle::LARGE);
|
||||
OLED::print(translatedString(OffString), FontStyle::LARGE);
|
||||
} else {
|
||||
OLED::printNumber(systemSettings.ShutdownTime, 2, FontStyle::LARGE);
|
||||
OLED::print(SymbolMinutes, FontStyle::LARGE);
|
||||
@@ -546,7 +546,7 @@ static bool settings_setPowerLimit(void) {
|
||||
static bool settings_displayPowerLimit(void) {
|
||||
printShortDescription(SettingsItemIndex::PowerLimit, 5);
|
||||
if (systemSettings.powerLimit == 0) {
|
||||
OLED::print(OffString, FontStyle::LARGE);
|
||||
OLED::print(translatedString(OffString), FontStyle::LARGE);
|
||||
} else {
|
||||
OLED::printNumber(systemSettings.powerLimit, 2, FontStyle::LARGE);
|
||||
OLED::print(SymbolWatts, FontStyle::LARGE);
|
||||
@@ -564,7 +564,7 @@ static bool settings_setScrollSpeed(void) {
|
||||
|
||||
static bool settings_displayScrollSpeed(void) {
|
||||
printShortDescription(SettingsItemIndex::ScrollingSpeed, 7);
|
||||
OLED::print((systemSettings.descriptionScrollSpeed) ? SettingFastChar : SettingSlowChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString((systemSettings.descriptionScrollSpeed) ? SettingFastChar : SettingSlowChar), FontStyle::LARGE);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -592,16 +592,16 @@ static bool settings_displayDisplayRotation(void) {
|
||||
|
||||
switch (systemSettings.OrientationMode) {
|
||||
case 0:
|
||||
OLED::print(SettingRightChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingRightChar), FontStyle::LARGE);
|
||||
break;
|
||||
case 1:
|
||||
OLED::print(SettingLeftChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingLeftChar), FontStyle::LARGE);
|
||||
break;
|
||||
case 2:
|
||||
OLED::print(SettingAutoChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingAutoChar), FontStyle::LARGE);
|
||||
break;
|
||||
default:
|
||||
OLED::print(SettingRightChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingRightChar), FontStyle::LARGE);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@@ -637,7 +637,7 @@ static bool settings_displayBoostTemp(void) {
|
||||
if (systemSettings.BoostTemp) {
|
||||
OLED::printNumber(systemSettings.BoostTemp, 3, FontStyle::LARGE);
|
||||
} else {
|
||||
OLED::print(OffString, FontStyle::LARGE);
|
||||
OLED::print(translatedString(OffString), FontStyle::LARGE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -653,19 +653,19 @@ static bool settings_displayAutomaticStartMode(void) {
|
||||
|
||||
switch (systemSettings.autoStartMode) {
|
||||
case 0:
|
||||
OLED::print(SettingStartNoneChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingStartNoneChar), FontStyle::LARGE);
|
||||
break;
|
||||
case 1:
|
||||
OLED::print(SettingStartSolderingChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingStartSolderingChar), FontStyle::LARGE);
|
||||
break;
|
||||
case 2:
|
||||
OLED::print(SettingStartSleepChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingStartSleepChar), FontStyle::LARGE);
|
||||
break;
|
||||
case 3:
|
||||
OLED::print(SettingStartSleepOffChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingStartSleepOffChar), FontStyle::LARGE);
|
||||
break;
|
||||
default:
|
||||
OLED::print(SettingStartNoneChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingStartNoneChar), FontStyle::LARGE);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@@ -682,16 +682,16 @@ static bool settings_displayLockingMode(void) {
|
||||
|
||||
switch (systemSettings.lockingMode) {
|
||||
case 0:
|
||||
OLED::print(SettingLockDisableChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingLockDisableChar), FontStyle::LARGE);
|
||||
break;
|
||||
case 1:
|
||||
OLED::print(SettingLockBoostChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingLockBoostChar), FontStyle::LARGE);
|
||||
break;
|
||||
case 2:
|
||||
OLED::print(SettingLockFullChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingLockFullChar), FontStyle::LARGE);
|
||||
break;
|
||||
default:
|
||||
OLED::print(SettingLockDisableChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingLockDisableChar), FontStyle::LARGE);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@@ -709,9 +709,9 @@ static bool settings_displayCoolingBlinkEnabled(void) {
|
||||
}
|
||||
|
||||
static bool settings_setResetSettings(void) {
|
||||
if (userConfirmation(SettingsResetWarning)) {
|
||||
if (userConfirmation(translatedString(SettingsResetWarning))) {
|
||||
resetSettings();
|
||||
warnUser(ResetOKMessage, 2 * TICKS_SECOND);
|
||||
warnUser(translatedString(ResetOKMessage), 2 * TICKS_SECOND);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -754,7 +754,7 @@ static void setTipOffset() {
|
||||
// If not only do single point tuning as per usual
|
||||
static bool settings_setCalibrate(void) {
|
||||
|
||||
if (userConfirmation(SettingsCalibrationWarning)) {
|
||||
if (userConfirmation(translatedString(SettingsCalibrationWarning))) {
|
||||
// User confirmed
|
||||
// So we now perform the actual calculation
|
||||
setTipOffset();
|
||||
@@ -881,7 +881,7 @@ static bool settings_displayPowerPulse(void) {
|
||||
OLED::print(SymbolDot, FontStyle::LARGE);
|
||||
OLED::printNumber(systemSettings.KeepAwakePulse % 10, 1, FontStyle::LARGE);
|
||||
} else {
|
||||
OLED::print(OffString, FontStyle::LARGE);
|
||||
OLED::print(translatedString(OffString), FontStyle::LARGE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -907,16 +907,16 @@ static bool settings_displayAnimationSpeed(void) {
|
||||
printShortDescription(SettingsItemIndex::AnimSpeed, 7);
|
||||
switch (systemSettings.animationSpeed) {
|
||||
case settingOffSpeed_t::SLOW:
|
||||
OLED::print(SettingSlowChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingSlowChar), FontStyle::LARGE);
|
||||
break;
|
||||
case settingOffSpeed_t::MEDIUM:
|
||||
OLED::print(SettingMediumChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingMediumChar), FontStyle::LARGE);
|
||||
break;
|
||||
case settingOffSpeed_t::FAST:
|
||||
OLED::print(SettingFastChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingFastChar), FontStyle::LARGE);
|
||||
break;
|
||||
default:
|
||||
OLED::print(SettingOffChar, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingOffChar), FontStyle::LARGE);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@@ -967,17 +967,17 @@ static bool settings_displayHallEffect(void) {
|
||||
printShortDescription(SettingsItemIndex::HallEffSensitivity, 7);
|
||||
switch (systemSettings.hallEffectSensitivity) {
|
||||
case 1:
|
||||
OLED::print(SettingSensitivityLow, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingSensitivityLow), FontStyle::LARGE);
|
||||
break;
|
||||
case 2:
|
||||
OLED::print(SettingSensitivityMedium, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingSensitivityMedium), FontStyle::LARGE);
|
||||
break;
|
||||
case 3:
|
||||
OLED::print(SettingSensitivityHigh, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingSensitivityHigh), FontStyle::LARGE);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
OLED::print(SettingSensitivityOff, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SettingSensitivityOff), FontStyle::LARGE);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@@ -996,7 +996,7 @@ static bool animOpenState = false;
|
||||
static void displayMenu(size_t index) {
|
||||
// Call into the menu
|
||||
// Draw title
|
||||
OLED::printWholeScreen(SettingsMenuEntries[index]);
|
||||
OLED::printWholeScreen(translatedString(SettingsMenuEntries[index]));
|
||||
// Draw symbol
|
||||
// 16 pixel wide image
|
||||
// 2 pixel wide scrolling indicator
|
||||
@@ -1128,7 +1128,7 @@ void gui_Menu(const menuitem *menu) {
|
||||
// Draw description
|
||||
if (descriptionStart == 0)
|
||||
descriptionStart = xTaskGetTickCount();
|
||||
const char *description = SettingsDescriptions[menu[currentScreen].description - 1];
|
||||
const char *description = translatedString(SettingsDescriptions[menu[currentScreen].description - 1]);
|
||||
// lower the value - higher the speed
|
||||
int16_t descriptionWidth = FONT_12_WIDTH * (str_display_len(description) + 7);
|
||||
int16_t descriptionOffset = ((xTaskGetTickCount() - descriptionStart) / (systemSettings.descriptionScrollSpeed == 1 ? (TICKS_100MS / 10) : (TICKS_100MS / 5)));
|
||||
|
||||
@@ -107,13 +107,13 @@ static bool checkVoltageForExit() {
|
||||
OLED::clearScreen();
|
||||
OLED::setCursor(0, 0);
|
||||
if (systemSettings.detailedSoldering) {
|
||||
OLED::print(UndervoltageString, FontStyle::SMALL);
|
||||
OLED::print(translatedString(UndervoltageString), FontStyle::SMALL);
|
||||
OLED::setCursor(0, 8);
|
||||
OLED::print(InputVoltageString, FontStyle::SMALL);
|
||||
OLED::print(translatedString(InputVoltageString), FontStyle::SMALL);
|
||||
printVoltage();
|
||||
OLED::print(SymbolVolts, FontStyle::SMALL);
|
||||
} else {
|
||||
OLED::print(UVLOWarningString, FontStyle::LARGE);
|
||||
OLED::print(translatedString(UVLOWarningString), FontStyle::LARGE);
|
||||
}
|
||||
|
||||
OLED::refresh();
|
||||
@@ -326,9 +326,9 @@ static int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
|
||||
OLED::clearScreen();
|
||||
OLED::setCursor(0, 0);
|
||||
if (systemSettings.detailedSoldering) {
|
||||
OLED::print(SleepingAdvancedString, FontStyle::SMALL);
|
||||
OLED::print(translatedString(SleepingAdvancedString), FontStyle::SMALL);
|
||||
OLED::setCursor(0, 8);
|
||||
OLED::print(SleepingTipAdvancedString, FontStyle::SMALL);
|
||||
OLED::print(translatedString(SleepingTipAdvancedString), FontStyle::SMALL);
|
||||
OLED::printNumber(tipTemp, 3, FontStyle::SMALL);
|
||||
if (systemSettings.temperatureInF)
|
||||
OLED::print(SymbolDegF, FontStyle::SMALL);
|
||||
@@ -340,7 +340,7 @@ static int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
|
||||
printVoltage();
|
||||
OLED::print(SymbolVolts, FontStyle::SMALL);
|
||||
} else {
|
||||
OLED::print(SleepingSimpleString, FontStyle::LARGE);
|
||||
OLED::print(translatedString(SleepingSimpleString), FontStyle::LARGE);
|
||||
OLED::printNumber(tipTemp, 3, FontStyle::LARGE);
|
||||
if (systemSettings.temperatureInF)
|
||||
OLED::drawSymbol(0);
|
||||
@@ -462,7 +462,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
case BUTTON_BOTH_LONG:
|
||||
// Unlock buttons
|
||||
buttonsLocked = false;
|
||||
warnUser(UnlockingKeysString, TICKS_SECOND);
|
||||
warnUser(translatedString(UnlockingKeysString), TICKS_SECOND);
|
||||
break;
|
||||
case BUTTON_F_LONG:
|
||||
// if boost mode is enabled turn it on
|
||||
@@ -476,7 +476,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
case BUTTON_F_SHORT:
|
||||
case BUTTON_B_SHORT:
|
||||
// Do nothing and display a lock warming
|
||||
warnUser(WarningKeysLockedString, TICKS_SECOND / 2);
|
||||
warnUser(translatedString(WarningKeysLockedString), TICKS_SECOND / 2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -511,7 +511,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
if (systemSettings.lockingMode != 0) {
|
||||
// Lock buttons
|
||||
buttonsLocked = true;
|
||||
warnUser(LockingKeysString, TICKS_SECOND);
|
||||
warnUser(translatedString(LockingKeysString), TICKS_SECOND);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -523,7 +523,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
OLED::clearScreen();
|
||||
// Draw in the screen details
|
||||
if (systemSettings.detailedSoldering) {
|
||||
OLED::print(SolderingAdvancedPowerPrompt, FontStyle::SMALL); // Power:
|
||||
OLED::print(translatedString(SolderingAdvancedPowerPrompt), FontStyle::SMALL); // Power:
|
||||
OLED::printNumber(x10WattHistory.average() / 10, 2, FontStyle::SMALL);
|
||||
OLED::print(SymbolDot, FontStyle::SMALL);
|
||||
OLED::printNumber(x10WattHistory.average() % 10, 1, FontStyle::SMALL);
|
||||
@@ -535,7 +535,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
}
|
||||
|
||||
OLED::setCursor(0, 8);
|
||||
OLED::print(SleepingTipAdvancedString, FontStyle::SMALL);
|
||||
OLED::print(translatedString(SleepingTipAdvancedString), FontStyle::SMALL);
|
||||
gui_drawTipTemp(true, FontStyle::SMALL);
|
||||
|
||||
if (boostModeOn) {
|
||||
@@ -713,7 +713,7 @@ void showDebugMenu(void) {
|
||||
void showWarnings() {
|
||||
// Display alert if settings were reset
|
||||
if (settingsWereReset) {
|
||||
warnUser(SettingsResetMessage, 10 * TICKS_SECOND);
|
||||
warnUser(translatedString(SettingsResetMessage), 10 * TICKS_SECOND);
|
||||
}
|
||||
#ifndef NO_WARN_MISSING
|
||||
// We also want to alert if accel or pd is not detected / not responding
|
||||
@@ -727,7 +727,7 @@ void showWarnings() {
|
||||
if (systemSettings.accelMissingWarningCounter < 2) {
|
||||
systemSettings.accelMissingWarningCounter++;
|
||||
saveSettings();
|
||||
warnUser(NoAccelerometerMessage, 10 * TICKS_SECOND);
|
||||
warnUser(translatedString(NoAccelerometerMessage), 10 * TICKS_SECOND);
|
||||
}
|
||||
}
|
||||
#ifdef POW_PD
|
||||
@@ -736,7 +736,7 @@ void showWarnings() {
|
||||
if (systemSettings.pdMissingWarningCounter < 2) {
|
||||
systemSettings.pdMissingWarningCounter++;
|
||||
saveSettings();
|
||||
warnUser(NoPowerDeliveryMessage, 10 * TICKS_SECOND);
|
||||
warnUser(translatedString(NoPowerDeliveryMessage), 10 * TICKS_SECOND);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -844,16 +844,16 @@ void startGUITask(void const *argument __unused) {
|
||||
OLED::setCursor(0, 0);
|
||||
if (systemSettings.detailedIDLE) {
|
||||
if (tipTemp > tipDisconnectedThres) {
|
||||
OLED::print(TipDisconnectedString, FontStyle::SMALL);
|
||||
OLED::print(translatedString(TipDisconnectedString), FontStyle::SMALL);
|
||||
} else {
|
||||
OLED::print(IdleTipString, FontStyle::SMALL);
|
||||
OLED::print(translatedString(IdleTipString), FontStyle::SMALL);
|
||||
gui_drawTipTemp(false, FontStyle::SMALL);
|
||||
OLED::print(IdleSetString, FontStyle::SMALL);
|
||||
OLED::print(translatedString(IdleSetString), FontStyle::SMALL);
|
||||
OLED::printNumber(systemSettings.SolderingTemp, 3, FontStyle::SMALL);
|
||||
}
|
||||
OLED::setCursor(0, 8);
|
||||
|
||||
OLED::print(InputVoltageString, FontStyle::SMALL);
|
||||
OLED::print(translatedString(InputVoltageString), FontStyle::SMALL);
|
||||
printVoltage();
|
||||
|
||||
} else {
|
||||
|
||||
@@ -322,7 +322,7 @@ Core/Gen/Translation.%.cpp: ../Translations/translation_%.json Makefile ../Trans
|
||||
@python3 ../Translations/make_translation.py -o $(PWD)/$@ $*
|
||||
|
||||
clean :
|
||||
rm -Rf $(SOURCE_CORE_DIR)/Translation.cpp Core/Gen
|
||||
rm -Rf Core/Gen
|
||||
rm -Rf $(OUTPUT_DIR_BASE)
|
||||
rm -Rf $(HEXFILE_DIR)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user