DB/LanguageWords: Difference between revisions
Jump to navigation
Jump to search
Barncastle (talk | contribs) mNo edit summary |
|||
Line 18: | Line 18: | ||
** Everything is UTF8-aware. Older versions (e.g. Vanilla) are not. | ** Everything is UTF8-aware. Older versions (e.g. Vanilla) are not. | ||
** Text is split into words. | ** Text is split into words. | ||
*** <tt>wordHash = SStrHash (word)</tt> | *** <tt>wordHash = [[SStrHash]] (word, false, 0)</tt> | ||
*** If <tt>wordHash % 300 < languageSkill</tt>, the word is not modified. | *** If <tt>wordHash % 300 < languageSkill</tt>, the word is not modified. | ||
*** <tt>wordLen</tt> is UTF8-aware, but limited to a maximum of 18. | *** <tt>wordLen</tt> is UTF8-aware, but limited to a maximum of 18. |
Latest revision as of 18:53, 19 April 2020
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.
- 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.