- if cls == tables.Pokemon:
- for foreign_name in row.foreign_names:
- name = foreign_name.name.lower()
- writer.add_document(name=name,
- language=foreign_name.language.name,
+ for foreign_name in getattr(row, 'foreign_names', []):
+ moonspeak = foreign_name.name.lower()
+ if name == moonspeak:
+ # Don't add the English name again as a different language;
+ # no point and it makes spell results confusing
+ continue
+
+ writer.add_document(name=moonspeak,
+ language=foreign_name.language.name,
+ **row_key)
+ speller_entries.append((moonspeak, 3))
+
+ # Add Roomaji too
+ if foreign_name.language.name == 'Japanese':
+ roomaji = romanize(foreign_name.name).lower()
+ writer.add_document(name=roomaji, language='Roomaji',