Rough link unique language ID
This commit is contained in:
@@ -31,6 +31,7 @@ extern FontSection DynamicFontSections[];
|
|||||||
|
|
||||||
struct LanguageMeta {
|
struct LanguageMeta {
|
||||||
char code[8];
|
char code[8];
|
||||||
|
uint16_t uniqueID;
|
||||||
const uint8_t *translation_data;
|
const uint8_t *translation_data;
|
||||||
uint16_t translation_size : 15;
|
uint16_t translation_size : 15;
|
||||||
bool translation_is_compressed : 1;
|
bool translation_is_compressed : 1;
|
||||||
|
|||||||
@@ -12,9 +12,11 @@ static uint8_t selectedLangIndex = 255;
|
|||||||
|
|
||||||
static void initSelectedLanguageIndex() {
|
static void initSelectedLanguageIndex() {
|
||||||
if (selectedLangIndex == 255) {
|
if (selectedLangIndex == 255) {
|
||||||
const char *lang = const_cast<char *>(systemSettings.uiLanguage);
|
|
||||||
|
const uint16_t wantedLanguageID = getSettingValue(SettingsOptions::UILanguage);
|
||||||
|
|
||||||
for (size_t i = 0; i < LanguageCount; i++) {
|
for (size_t i = 0; i < LanguageCount; i++) {
|
||||||
if (strncmp(lang, LanguageMetas[i].code, sizeof(systemSettings.uiLanguage)) == 0) {
|
if (LanguageMetas[i].uniqueID == wantedLanguageID) {
|
||||||
selectedLangIndex = i;
|
selectedLangIndex = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -24,10 +26,7 @@ static void initSelectedLanguageIndex() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void writeSelectedLanguageToSettings() {
|
static void writeSelectedLanguageToSettings() { setSettingValue(SettingsOptions::UILanguage, LanguageMetas[selectedLangIndex].uniqueID); }
|
||||||
char *lang = const_cast<char *>(systemSettings.uiLanguage);
|
|
||||||
strncpy(lang, LanguageMetas[selectedLangIndex].code, sizeof(systemSettings.uiLanguage));
|
|
||||||
}
|
|
||||||
|
|
||||||
void prepareTranslations() {
|
void prepareTranslations() {
|
||||||
initSelectedLanguageIndex();
|
initSelectedLanguageIndex();
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp
|
|||||||
{0, 4, 1, 1}, // HallEffectSensitivity
|
{0, 4, 1, 1}, // HallEffectSensitivity
|
||||||
{0, 10, 1, 0}, // AccelMissingWarningCounter
|
{0, 10, 1, 0}, // AccelMissingWarningCounter
|
||||||
{0, 10, 1, 0}, // PDMissingWarningCounter
|
{0, 10, 1, 0}, // PDMissingWarningCounter
|
||||||
{0, 0, 0, 0}, // UILanguage
|
{0, 0xFFFF, 0, 41431 /*EN*/}, // UILanguage
|
||||||
{0, 50, 1, 0}, // PDNegTimeout
|
{0, 50, 1, 0}, // PDNegTimeout
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user