refactor: Store only unique localization strings in offset buffers (#1802)

## Summary

Omit any duplicate strings in non-English localization lookup tables.
For non-English lookup offsets, tag bit 15 to indicate the offset
applies to the English localization table.

Saves 18,766 bytes of flash.

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**PARTIALLY**_
This commit is contained in:
Zach Nelson
2026-05-02 16:14:12 -05:00
committed by GitHub
parent ba4a361d64
commit 64ecfe2ef3
2 changed files with 64 additions and 33 deletions
+5 -1
View File
@@ -20,7 +20,11 @@ const char* I18n::get(StrId id) const {
// Use generated helper function - no hardcoded switch needed!
const LangStrings lang = getLanguageStrings(_language);
return lang.data + lang.offsets[index];
// If bit 15 of the offset is set, apply the offset to the English lookup table
const uint16_t off = lang.offsets[index];
if (off & 0x8000) return STRINGS_EN_DATA + (off & 0x7FFF);
return lang.data + off;
}
void I18n::setLanguage(Language lang) {