DB/LanguageWords: Difference between revisions
Jump to navigation
Jump to search
Barncastle (talk | contribs) mNo edit summary |
Barncastle (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
==0.5.3.3368, 1.12.1.5875== | ==0.5.3.3368, 1.12.1.5875, 6.0.1.18179== | ||
struct LanguageWordsRec { | struct LanguageWordsRec { | ||
uint32_t m_ID; | uint32_t m_ID; | ||
Line 11: | Line 11: | ||
3 Text String Any given syllable/word of a language | 3 Text String Any given syllable/word of a language | ||
==ChatTranslate::Translate== | ==ChatTranslate::Translate== | ||
* On initialization, the client groups this table into <tt>s_wordList</tt> by <tt>m_languageID</tt> and <tt>strlen (m_word)</tt>, maintaining order of records like in the DB. | * On initialization, the client groups this table into <tt>s_wordList</tt> by <tt>m_languageID</tt> and <tt>strlen (m_word)</tt>, maintaining order of records like in the DB. |
Revision as of 14:24, 12 October 2017
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)
- 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.
- 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.