# Path: pokedex/db/tables.py
# class TableSuperclass(object):
# class TableMetaclass(DeclarativeMeta):
# class Language(TableBase):
# class Ability(TableBase):
# class AbilityChangelog(TableBase):
# class AbilityFlavorText(TableBase):
# class Berry(TableBase):
# class BerryFirmness(TableBase):
# class BerryFlavor(TableBase):
# class Characteristic(TableBase):
# class ConquestEpisode(TableBase):
# class ConquestEpisodeWarrior(TableBase):
# class ConquestKingdom(TableBase):
# class ConquestMaxLink(TableBase):
# class ConquestMoveData(TableBase):
# class ConquestMoveDisplacement(TableBase):
# class ConquestMoveEffect(TableBase):
# class ConquestMoveRange(TableBase):
# class ConquestPokemonAbility(TableBase):
# class ConquestPokemonEvolution(TableBase):
# class ConquestPokemonMove(TableBase):
# class ConquestPokemonStat(TableBase):
# class ConquestStat(TableBase):
# class ConquestTransformationPokemon(TableBase):
# class ConquestTransformationWarrior(TableBase):
# class ConquestWarrior(TableBase):
# class ConquestWarriorArchetype(TableBase):
# class ConquestWarriorRank(TableBase):
# class ConquestWarriorRankStatMap(TableBase):
# class ConquestWarriorSkill(TableBase):
# class ConquestWarriorSpecialty(TableBase):
# class ConquestWarriorStat(TableBase):
# class ConquestWarriorTransformation(TableBase):
# class ContestCombo(TableBase):
# class ContestEffect(TableBase):
# class ContestType(TableBase):
# class EggGroup(TableBase):
# class Encounter(TableBase):
# class EncounterCondition(TableBase):
# class EncounterConditionValue(TableBase):
# class EncounterConditionValueMap(TableBase):
# class EncounterMethod(TableBase):
# class EncounterSlot(TableBase):
# class EvolutionChain(TableBase):
# class EvolutionTrigger(TableBase):
# class Experience(TableBase):
# class Gender(TableBase):
# class Generation(TableBase):
# class GrowthRate(TableBase):
# class Item(TableBase):
# class ItemCategory(TableBase):
# class ItemFlag(TableBase):
# class ItemFlagMap(TableBase):
# class ItemFlavorText(TableBase):
# class ItemFlingEffect(TableBase):
# class ItemGameIndex(TableBase):
# class ItemPocket(TableBase):
# class Location(TableBase):
# class LocationArea(TableBase):
# class LocationAreaEncounterRate(TableBase):
# class LocationGameIndex(TableBase):
# class Machine(TableBase):
# class Move(TableBase):
# class MoveBattleStyle(TableBase):
# class MoveChangelog(TableBase):
# class MoveDamageClass(TableBase):
# class MoveEffect(TableBase):
# class MoveEffectChangelog(TableBase):
# class MoveFlag(TableBase):
# class MoveFlagMap(TableBase):
# class MoveFlavorText(TableBase):
# class MoveMeta(TableBase):
# class MoveMetaAilment(TableBase):
# class MoveMetaCategory(TableBase):
# class MoveMetaStatChange(TableBase):
# class MoveTarget(TableBase):
# class Nature(TableBase):
# class NatureBattleStylePreference(TableBase):
# class NaturePokeathlonStat(TableBase):
# class PalPark(TableBase):
# class PalParkArea(TableBase):
# class PokeathlonStat(TableBase):
# class Pokedex(TableBase):
# class PokedexVersionGroup(TableBase):
# class Pokemon(TableBase):
# class PokemonAbility(TableBase):
# class PokemonColor(TableBase):
# class PokemonDexNumber(TableBase):
# class PokemonEggGroup(TableBase):
# class PokemonEvolution(TableBase):
# class PokemonForm(TableBase):
# class PokemonFormGeneration(TableBase):
# class PokemonFormPokeathlonStat(TableBase):
# class PokemonGameIndex(TableBase):
# class PokemonHabitat(TableBase):
# class PokemonItem(TableBase):
# class PokemonMove(TableBase):
# class PokemonMoveMethod(TableBase):
# class PokemonShape(TableBase):
# class PokemonSpecies(TableBase):
# class PokemonSpeciesFlavorText(TableBase):
# class PokemonStat(TableBase):
# class PokemonType(TableBase):
# class Region(TableBase):
# class Stat(TableBase):
# class SuperContestCombo(TableBase):
# class SuperContestEffect(TableBase):
# class Type(TableBase):
# class TypeEfficacy(TableBase):
# class TypeGameIndex(TableBase):
# class Version(TableBase):
# class VersionGroup(TableBase):
# class VersionGroupPokemonMoveMethod(TableBase):
# class VersionGroupRegion(TableBase):
#     def __unicode__(self):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(cls, name, bases, attrs):
#     def star_rating(self):
#     def appears_underground(self):
#     def is_hm(self):
#     def recoil(self):
#     def is_neutral(self):
#     def name(self):
#     def stat(self, stat_identifier):
#     def base_stat(self, stat_identifier, default=0):
#     def better_damage_class(self):
#     def name(self):
# 
# Path: pokedex/defaults.py
# def get_default_csv_dir():
#     return get_default_csv_dir_with_origin()[0]


import binascii
import csv
import io
import os
import re
import six
from collections import defaultdict
from six.moves import zip
from pokedex.db import tables
from pokedex.defaults import get_default_csv_dir
#! /usr/bin/env python
u"""General handling of translations

The general idea is to get messages from somewhere: the source pokedex CSVs,
or the translation CSVs, etc., then merge them together in some way, and shove
them into the database.

If a message is translated, it has a source string attached to it, with the
original English version. Or at least it has a CRC of the original.
When that doesn't match, it means the English string changed and the
translation has to be updated.
Also this is why we can't dump translations from the database: there's no
original string info.

Some complications:

Flavor text is so repetitive that we take strings from all the version,

# Path: pokedex/db/tables.py
# class TableSuperclass(object):
# class TableMetaclass(DeclarativeMeta):
# class Language(TableBase):
# class Ability(TableBase):
# class AbilityChangelog(TableBase):
# class AbilityFlavorText(TableBase):
# class Berry(TableBase):
# class BerryFirmness(TableBase):
# class BerryFlavor(TableBase):
# class Characteristic(TableBase):
# class ConquestEpisode(TableBase):
# class ConquestEpisodeWarrior(TableBase):
# class ConquestKingdom(TableBase):
# class ConquestMaxLink(TableBase):
# class ConquestMoveData(TableBase):
# class ConquestMoveDisplacement(TableBase):
# class ConquestMoveEffect(TableBase):
# class ConquestMoveRange(TableBase):
# class ConquestPokemonAbility(TableBase):
# class ConquestPokemonEvolution(TableBase):
# class ConquestPokemonMove(TableBase):
# class ConquestPokemonStat(TableBase):
# class ConquestStat(TableBase):
# class ConquestTransformationPokemon(TableBase):
# class ConquestTransformationWarrior(TableBase):
# class ConquestWarrior(TableBase):
# class ConquestWarriorArchetype(TableBase):
# class ConquestWarriorRank(TableBase):
# class ConquestWarriorRankStatMap(TableBase):
# class ConquestWarriorSkill(TableBase):
# class ConquestWarriorSpecialty(TableBase):
# class ConquestWarriorStat(TableBase):
# class ConquestWarriorTransformation(TableBase):
# class ContestCombo(TableBase):
# class ContestEffect(TableBase):
# class ContestType(TableBase):
# class EggGroup(TableBase):
# class Encounter(TableBase):
# class EncounterCondition(TableBase):
# class EncounterConditionValue(TableBase):
# class EncounterConditionValueMap(TableBase):
# class EncounterMethod(TableBase):
# class EncounterSlot(TableBase):
# class EvolutionChain(TableBase):
# class EvolutionTrigger(TableBase):
# class Experience(TableBase):
# class Gender(TableBase):
# class Generation(TableBase):
# class GrowthRate(TableBase):
# class Item(TableBase):
# class ItemCategory(TableBase):
# class ItemFlag(TableBase):
# class ItemFlagMap(TableBase):
# class ItemFlavorText(TableBase):
# class ItemFlingEffect(TableBase):
# class ItemGameIndex(TableBase):
# class ItemPocket(TableBase):
# class Location(TableBase):
# class LocationArea(TableBase):
# class LocationAreaEncounterRate(TableBase):
# class LocationGameIndex(TableBase):
# class Machine(TableBase):
# class Move(TableBase):
# class MoveBattleStyle(TableBase):
# class MoveChangelog(TableBase):
# class MoveDamageClass(TableBase):
# class MoveEffect(TableBase):
# class MoveEffectChangelog(TableBase):
# class MoveFlag(TableBase):
# class MoveFlagMap(TableBase):
# class MoveFlavorText(TableBase):
# class MoveMeta(TableBase):
# class MoveMetaAilment(TableBase):
# class MoveMetaCategory(TableBase):
# class MoveMetaStatChange(TableBase):
# class MoveTarget(TableBase):
# class Nature(TableBase):
# class NatureBattleStylePreference(TableBase):
# class NaturePokeathlonStat(TableBase):
# class PalPark(TableBase):
# class PalParkArea(TableBase):
# class PokeathlonStat(TableBase):
# class Pokedex(TableBase):
# class PokedexVersionGroup(TableBase):
# class Pokemon(TableBase):
# class PokemonAbility(TableBase):
# class PokemonColor(TableBase):
# class PokemonDexNumber(TableBase):
# class PokemonEggGroup(TableBase):
# class PokemonEvolution(TableBase):
# class PokemonForm(TableBase):
# class PokemonFormGeneration(TableBase):
# class PokemonFormPokeathlonStat(TableBase):
# class PokemonGameIndex(TableBase):
# class PokemonHabitat(TableBase):
# class PokemonItem(TableBase):
# class PokemonMove(TableBase):
# class PokemonMoveMethod(TableBase):
# class PokemonShape(TableBase):
# class PokemonSpecies(TableBase):
# class PokemonSpeciesFlavorText(TableBase):
# class PokemonStat(TableBase):
# class PokemonType(TableBase):
# class Region(TableBase):
# class Stat(TableBase):
# class SuperContestCombo(TableBase):
# class SuperContestEffect(TableBase):
# class Type(TableBase):
# class TypeEfficacy(TableBase):
# class TypeGameIndex(TableBase):
# class Version(TableBase):
# class VersionGroup(TableBase):
# class VersionGroupPokemonMoveMethod(TableBase):
# class VersionGroupRegion(TableBase):
#     def __unicode__(self):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(cls, name, bases, attrs):
#     def star_rating(self):
#     def appears_underground(self):
#     def is_hm(self):
#     def recoil(self):
#     def is_neutral(self):
#     def name(self):
#     def stat(self, stat_identifier):
#     def base_stat(self, stat_identifier, default=0):
#     def better_damage_class(self):
#     def name(self):
# 
# Path: pokedex/defaults.py
# def get_default_csv_dir():
#     return get_default_csv_dir_with_origin()[0]


# Path: pokedex/db/translations.py
import binascii
import csv
import io
import os
import re
import six
from collections import defaultdict
from six.moves import zip
from pokedex.db import tables
from pokedex.defaults import get_default_csv_dir

#! /usr/bin/env python
u"""General handling of translations

The general idea is to get messages from somewhere: the source pokedex CSVs,
or the translation CSVs, etc., then merge them together in some way, and shove
them into the database.

If a message is translated, it has a source string attached to it, with the
original English version. Or at least it has a CRC of the original.
When that doesn't match, it means the English string changed and the
translation has to be updated.
Also this is why we can't dump translations from the database: there's no
original string info.

Some complications:

Flavor text is so repetitive that we take strings from all the version,

separate the unique ones by blank lines, let translators work on that, and then