From wowdev
Jump to navigation Jump to search,,

struct LanguageWordsRec {
  uint32_t m_ID;
  uint32_t m_languageID;
  stringref m_word;


Column	Field 			Type 		Notes 
1 	ID 			Integer 	
2 	iRefID_Languages 	Integer 	
3 	Text 			String 		Any given syllable/word of a language 


  • 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.