New ML support - language.c - fixed return origial string for zero length translation

This commit is contained in:
Robert Pelnar 2018-05-27 16:24:21 +02:00
parent 55157640c5
commit def9ab56f6

View file

@ -39,6 +39,8 @@ const char* lang_get_translation(const char* s)
uint16_t ui = pgm_read_word(((uint16_t*)s)); //read string id uint16_t ui = pgm_read_word(((uint16_t*)s)); //read string id
if (ui == 0xffff) return s + 2; //translation not found if (ui == 0xffff) return s + 2; //translation not found
ui = pgm_read_word(((uint16_t*)(((char*)lang_table + 16 + ui*2)))); //read relative offset ui = pgm_read_word(((uint16_t*)(((char*)lang_table + 16 + ui*2)))); //read relative offset
if (pgm_read_byte(((uint8_t*)((char*)lang_table + ui))) == 0)
return s + 2;//not translated string
return (const char*)((char*)lang_table + ui); //return calculated pointer return (const char*)((char*)lang_table + ui); //return calculated pointer
} }