DB/LanguageWords
Jump to navigation
Jump to search
0.5.3.3368, 1.12.1.5875, 6.0.1.18179
struct LanguageWordsRec { uint32_t m_ID; uint32_t m_languageID; stringrefⁱ m_word; };
Structure
Column Field Type Notes 1 ID Integer 2 iRefID_Languages Integer 3 Text String Any given syllable/word of a language
ChatTranslate::Translate
- On initialization, the client groups this table into s_wordList by m_languageID and strlen (m_word), maintaining order of records like in the DB.
- On translation,
- the client first checks if languageSkill for the given language is >=300. If yes, the text is not modified.
- Hyperlinks are stripped.
- Everything is UTF8-aware. Older versions (e.g. Vanilla) are not.
- Text is split into words.
- wordHash = SStrHash (word, false, 0)
- If wordHash % 300 < languageSkill, the word is not modified.
- wordLen is UTF8-aware, but limited to a maximum of 18.
- s_wordList is searched for the first group having the right languageID and wordLen. If none is found, wordLen - 1 is tried, until wordLen == 1.
- If no group is found, the word is not modified.
- The wordHash % group.sizeth entry is taken and the word is replaced with m_word.
- The (languageSkill * wordHash) % group.sizeth entry is taken and the word is replaced with m_word.
Warpten (talk) Exact build of the switch unknown, last checked on 7.3.5's last retail build - code got stripped from client later.
- Depending on client locale, characters that are uppercase in the input force the replacement word's character to also be upper case. Some other locales copy the exact case (so also toLower()). In older versions, the CopyWordCase is called unconditionally of locale.
Warpten (talk) There are changes to UTF8 rules as well as well as handling for "Embedded Languages" - see 0x142A10290 in 4.4.0.56713