Overhauled text translations

This commit is contained in:
Maruno17
2023-01-08 17:11:38 +00:00
parent ae0d193bba
commit 632b0f8b4b
23 changed files with 757 additions and 710 deletions

View File

@@ -372,12 +372,14 @@ module Settings
#============================================================================= #=============================================================================
# An array of available languages in the game, and their corresponding message # An array of available languages in the game, and their corresponding
# file in the Data folder. Edit only if you have 2 or more languages to choose # filename. Text files for a language are extracted to a folder called
# from. # "Text_filename_core" or "Text_filename_game", and are recompiled into files
# in the Data folder called "messages_filename_core.dat" or
# "messages_filename_game.dat".
LANGUAGES = [ LANGUAGES = [
# ["English", "english.dat"], # ["English", "english"],
# ["Deutsch", "deutsch.dat"] # ["Deutsch", "deutsch"]
] ]
#============================================================================= #=============================================================================

File diff suppressed because it is too large Load Diff

View File

@@ -30,7 +30,7 @@ module Game
# Set language (and choose language if there is no save file) # Set language (and choose language if there is no save file)
if Settings::LANGUAGES.length >= 2 if Settings::LANGUAGES.length >= 2
$PokemonSystem.language = pbChooseLanguage if save_data.empty? $PokemonSystem.language = pbChooseLanguage if save_data.empty?
pbLoadMessages("Data/" + Settings::LANGUAGES[$PokemonSystem.language][1]) MessageTypes.load_message_files(Settings::LANGUAGES[$PokemonSystem.language][1])
end end
end end

View File

@@ -260,9 +260,11 @@ def pbGetBasicMapNameFromId(id)
end end
def pbGetMapNameFromId(id) def pbGetMapNameFromId(id)
name = pbGetMessage(MessageTypes::MapNames, id) name = GameData::MapMetadata.get(id)&.name
name = pbGetBasicMapNameFromId(id) if nil_or_empty?(name) if nil_or_empty?(name)
name.gsub!(/\\PN/, $player.name) if $player name = pbGetBasicMapNameFromId(id)
name.gsub!(/\\PN/, $player.name) if $player
end
return name return name
end end

View File

@@ -15,7 +15,7 @@ module GameData
"SectionName" => [:id, "u"], "SectionName" => [:id, "u"],
"Name" => [:real_name, "s"], "Name" => [:real_name, "s"],
"Filename" => [:filename, "s"], "Filename" => [:filename, "s"],
"Point" => [:point, "^uussUUUU"], "Point" => [:point, "^uusSUUUU"],
"Flags" => [:flags, "*s"] "Flags" => [:flags, "*s"]
} }
@@ -33,7 +33,7 @@ module GameData
# @return [String] the translated name of this region # @return [String] the translated name of this region
def name def name
return pbGetMessage(MessageTypes::RegionNames, @id) return pbGetMessageFromHash(MessageTypes::Regions, @real_name)
end end
def has_flag?(flag) def has_flag?(flag)

View File

@@ -35,7 +35,7 @@ module GameData
# @return [String] the translated description of this ability # @return [String] the translated description of this ability
def description def description
return pbGetMessageFromHash(MessageTypes::AbilityDescs, @real_description) return pbGetMessageFromHash(MessageTypes::AbilityDescriptions, @real_description)
end end
def has_flag?(flag) def has_flag?(flag)

View File

@@ -143,13 +143,13 @@ module GameData
# @return [String] the translated portion name of this item # @return [String] the translated portion name of this item
def portion_name def portion_name
return pbGetMessageFromHash(MessageTypes::ItemPortionNames, @real_portion_name) if @real_portion_name return pbGetMessageFromHash(MessageTypes::ItemPortions, @real_portion_name) if @real_portion_name
return name return name
end end
# @return [String] the translated plural version of the portion name of this item # @return [String] the translated plural version of the portion name of this item
def portion_name_plural def portion_name_plural
return pbGetMessageFromHash(MessageTypes::ItemPortionNamePlurals, @real_portion_name_plural) if @real_portion_name_plural return pbGetMessageFromHash(MessageTypes::ItemPortionPlurals, @real_portion_name_plural) if @real_portion_name_plural
return name_plural return name_plural
end end

View File

@@ -225,17 +225,17 @@ module GameData
# @return [String] the translated name of this form of this species # @return [String] the translated name of this form of this species
def form_name def form_name
return pbGetMessageFromHash(MessageTypes::FormNames, @real_form_name) return pbGetMessageFromHash(MessageTypes::SpeciesForms, @real_form_name)
end end
# @return [String] the translated Pokédex category of this species # @return [String] the translated Pokédex category of this species
def category def category
return pbGetMessageFromHash(MessageTypes::Kinds, @real_category) return pbGetMessageFromHash(MessageTypes::SpeciesCategories, @real_category)
end end
# @return [String] the translated Pokédex entry of this species # @return [String] the translated Pokédex entry of this species
def pokedex_entry def pokedex_entry
return pbGetMessageFromHash(MessageTypes::Entries, @real_pokedex_entry) return pbGetMessageFromHash(MessageTypes::PokedexEntries, @real_pokedex_entry)
end end
def default_form def default_form

View File

@@ -107,7 +107,7 @@ module GameData
# @return [String] the translated in-battle lose message of this trainer # @return [String] the translated in-battle lose message of this trainer
def lose_text def lose_text
return pbGetMessageFromHash(MessageTypes::TrainerLoseText, @real_lose_text) return pbGetMessageFromHash(MessageTypes::TrainerLoseTexts, @real_lose_text)
end end
# Creates a battle-ready version of a trainer's data. # Creates a battle-ready version of a trainer's data.

View File

@@ -115,7 +115,10 @@ module GameData
# @return [String] the translated name of this map # @return [String] the translated name of this map
def name def name
return pbGetMapNameFromId(@id) ret = pbGetMessageFromHash(MessageTypes::MapNames, @real_name)
ret = pbGetBasicMapNameFromId(@id) if nil_or_empty?(ret)
ret.gsub!(/\\PN/, $player.name) if $player
return ret
end end
def has_flag?(flag) def has_flag?(flag)

View File

@@ -7,7 +7,7 @@ class PokemonGlobalMetadata
attr_accessor :bicycle attr_accessor :bicycle
attr_accessor :surfing attr_accessor :surfing
attr_accessor :diving attr_accessor :diving
attr_accessor :sliding attr_accessor :ice_sliding
attr_accessor :fishing attr_accessor :fishing
# Player data # Player data
attr_accessor :startTime attr_accessor :startTime
@@ -58,7 +58,7 @@ class PokemonGlobalMetadata
@bicycle = false @bicycle = false
@surfing = false @surfing = false
@diving = false @diving = false
@sliding = false @ice_sliding = false
@fishing = false @fishing = false
# Player data # Player data
@startTime = Time.now @startTime = Time.now

View File

@@ -185,7 +185,7 @@ class PokemonRegionMap_Scene
@map.point.each do |point| @map.point.each do |point|
next if point[0] != x || point[1] != y next if point[0] != x || point[1] != y
return "" if point[7] && (@wallmap || point[7] <= 0 || !$game_switches[point[7]]) return "" if point[7] && (@wallmap || point[7] <= 0 || !$game_switches[point[7]])
name = pbGetMessageFromHash(MessageTypes::PlaceNames, point[2]) name = pbGetMessageFromHash(MessageTypes::RegionLocations, point[2])
return (@editor) ? point[2] : name return (@editor) ? point[2] : name
end end
return "" return ""
@@ -213,7 +213,8 @@ class PokemonRegionMap_Scene
@map.point.each do |point| @map.point.each do |point|
next if point[0] != x || point[1] != y next if point[0] != x || point[1] != y
return "" if point[7] && (@wallmap || point[7] <= 0 || !$game_switches[point[7]]) return "" if point[7] && (@wallmap || point[7] <= 0 || !$game_switches[point[7]])
mapdesc = pbGetMessageFromHash(MessageTypes::PlaceDescriptions, point[3]) return "" if !point[3]
mapdesc = pbGetMessageFromHash(MessageTypes::RegionDescriptions, point[3])
return (@editor) ? point[3] : mapdesc return (@editor) ? point[3] : mapdesc
end end
return "" return ""

View File

@@ -95,7 +95,7 @@ class PokemonPhone_Scene
end end
# Set info text # Set info text
infotext = _INTL("Registered<br>") infotext = _INTL("Registered<br>")
infotext += _INTL(" <r>{1}<br>", @sprites["list"].commands.length) infotext += _INTL("<r>{1}<br>", @sprites["list"].commands.length)
infotext += _INTL("Waiting for a rematch<r>{1}", rematch_count) infotext += _INTL("Waiting for a rematch<r>{1}", rematch_count)
@sprites["info"].text = infotext @sprites["info"].text = infotext
pbRefreshScreen pbRefreshScreen

View File

@@ -325,7 +325,7 @@ class PokemonLoadScreen
when cmd_language when cmd_language
@scene.pbEndScene @scene.pbEndScene
$PokemonSystem.language = pbChooseLanguage $PokemonSystem.language = pbChooseLanguage
pbLoadMessages("Data/" + Settings::LANGUAGES[$PokemonSystem.language][1]) MessageTypes.load_message_files(Settings::LANGUAGES[$PokemonSystem.language][1])
if show_continue if show_continue
@save_data[:pokemon_system] = $PokemonSystem @save_data[:pokemon_system] = $PokemonSystem
File.open(SaveData::FILE_PATH, "wb") { |file| Marshal.dump(@save_data, file) } File.open(SaveData::FILE_PATH, "wb") { |file| Marshal.dump(@save_data, file) }

View File

@@ -98,8 +98,8 @@ class BattleChallenge
opponent = pbGenerateBattleTrainer(self.nextTrainer, self.rules) opponent = pbGenerateBattleTrainer(self.nextTrainer, self.rules)
bttrainers = pbGetBTTrainers(@id) bttrainers = pbGetBTTrainers(@id)
trainerdata = bttrainers[self.nextTrainer] trainerdata = bttrainers[self.nextTrainer]
opponent.lose_text = pbGetMessageFromHash(MessageTypes::EndSpeechLose, trainerdata[4]) opponent.lose_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesLose, trainerdata[4])
opponent.win_text = pbGetMessageFromHash(MessageTypes::EndSpeechWin, trainerdata[3]) opponent.win_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesWin, trainerdata[3])
ret = pbOrganizedBattleEx(opponent, self.rules) ret = pbOrganizedBattleEx(opponent, self.rules)
return ret return ret
end end
@@ -376,8 +376,8 @@ class BattleFactoryData
pbGetMessageFromHash(MessageTypes::TrainerNames, trainerdata[1]), pbGetMessageFromHash(MessageTypes::TrainerNames, trainerdata[1]),
trainerdata[0] trainerdata[0]
) )
@opponent.lose_text = pbGetMessageFromHash(MessageTypes::EndSpeechLose, trainerdata[4]) @opponent.lose_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesLose, trainerdata[4])
@opponent.win_text = pbGetMessageFromHash(MessageTypes::EndSpeechWin, trainerdata[3]) @opponent.win_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesWin, trainerdata[3])
opponentPkmn = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps, @rentals) opponentPkmn = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps, @rentals)
@opponent.party = opponentPkmn.sample(3) @opponent.party = opponentPkmn.sample(3)
end end
@@ -401,8 +401,8 @@ class BattleFactoryData
pbGetMessageFromHash(MessageTypes::TrainerNames, trainerdata[1]), pbGetMessageFromHash(MessageTypes::TrainerNames, trainerdata[1]),
trainerdata[0] trainerdata[0]
) )
@opponent.lose_text = pbGetMessageFromHash(MessageTypes::EndSpeechLose, trainerdata[4]) @opponent.lose_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesLose, trainerdata[4])
@opponent.win_text = pbGetMessageFromHash(MessageTypes::EndSpeechWin, trainerdata[3]) @opponent.win_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesWin, trainerdata[3])
opponentPkmn = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps, opponentPkmn = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps,
[].concat(@rentals).concat(@oldopponent)) [].concat(@rentals).concat(@oldopponent))
@opponent.party = opponentPkmn.sample(3) @opponent.party = opponentPkmn.sample(3)

View File

@@ -92,7 +92,7 @@ def pbBattleChallengeBeginSpeech
return "..." if !pbBattleChallenge.pbInProgress? return "..." if !pbBattleChallenge.pbInProgress?
bttrainers = pbGetBTTrainers(pbBattleChallenge.currentChallenge) bttrainers = pbGetBTTrainers(pbBattleChallenge.currentChallenge)
tr = bttrainers[pbBattleChallenge.nextTrainer] tr = bttrainers[pbBattleChallenge.nextTrainer]
return (tr) ? pbGetMessageFromHash(MessageTypes::BeginSpeech, tr[2]) : "..." return (tr) ? pbGetMessageFromHash(MessageTypes::FrontierIntroSpeeches, tr[2]) : "..."
end end
#=============================================================================== #===============================================================================

View File

@@ -134,12 +134,13 @@ def getID(mod, constant)
return constant return constant
end end
def getConstantName(mod, value) def getConstantName(mod, value, raise_if_none = true)
mod = Object.const_get(mod) if mod.is_a?(Symbol) mod = Object.const_get(mod) if mod.is_a?(Symbol)
mod.constants.each do |c| mod.constants.each do |c|
return c.to_s if mod.const_get(c.to_sym) == value return c.to_s if mod.const_get(c.to_sym) == value
end end
raise _INTL("Value {1} not defined by a constant in {2}", value, mod.name) raise _INTL("Value {1} not defined by a constant in {2}", value, mod.name) if raise_if_none
return nil
end end
def getConstantNameOrValue(mod, value) def getConstantNameOrValue(mod, value)

View File

@@ -432,13 +432,13 @@ class Slider < UIControl
color = Color.new(120, 120, 120) color = Color.new(120, 120, 120)
bitmap.fill_rect(x, y, width, height, Color.new(0, 0, 0, 0)) bitmap.fill_rect(x, y, width, height, Color.new(0, 0, 0, 0))
size = bitmap.text_size(self.label).width size = bitmap.text_size(self.label).width
leftarrows = bitmap.text_size(_INTL(" << ")) leftarrows = bitmap.text_size(_INTL("<<"))
numbers = bitmap.text_size(" XXXX ").width numbers = bitmap.text_size(" XXXX ").width
rightarrows = bitmap.text_size(_INTL(" >> ")) rightarrows = bitmap.text_size(_INTL(">>"))
bitmap.font.color = color bitmap.font.color = color
shadowtext(bitmap, x, y, size, height, self.label) shadowtext(bitmap, x, y, size, height, self.label)
x += size x += size
shadowtext(bitmap, x, y, leftarrows.width, height, _INTL(" << "), shadowtext(bitmap, x, y, leftarrows.width, height, _INTL("<<"),
self.disabled || self.curvalue == self.minvalue) self.disabled || self.curvalue == self.minvalue)
@leftarrow = Rect.new(x, y, leftarrows.width, height) @leftarrow = Rect.new(x, y, leftarrows.width, height)
x += leftarrows.width x += leftarrows.width
@@ -447,7 +447,7 @@ class Slider < UIControl
shadowtext(bitmap, x, y, numbers, height, " #{self.curvalue} ", false, 1) shadowtext(bitmap, x, y, numbers, height, " #{self.curvalue} ", false, 1)
end end
x += numbers x += numbers
shadowtext(bitmap, x, y, rightarrows.width, height, _INTL(" >> "), shadowtext(bitmap, x, y, rightarrows.width, height, _INTL(">>"),
self.disabled || self.curvalue == self.maxvalue) self.disabled || self.curvalue == self.maxvalue)
@rightarrow = Rect.new(x, y, rightarrows.width, height) @rightarrow = Rect.new(x, y, rightarrows.width, height)
end end
@@ -681,12 +681,12 @@ class TextSlider < UIControl
color = Color.new(120, 120, 120) color = Color.new(120, 120, 120)
bitmap.fill_rect(x, y, width, height, Color.new(0, 0, 0, 0)) bitmap.fill_rect(x, y, width, height, Color.new(0, 0, 0, 0))
size = bitmap.text_size(self.label).width size = bitmap.text_size(self.label).width
leftarrows = bitmap.text_size(_INTL(" << ")) leftarrows = bitmap.text_size(_INTL("<<"))
rightarrows = bitmap.text_size(_INTL(" >> ")) rightarrows = bitmap.text_size(_INTL(">>"))
bitmap.font.color = color bitmap.font.color = color
shadowtext(bitmap, x, y, size, height, self.label) shadowtext(bitmap, x, y, size, height, self.label)
x += size x += size
shadowtext(bitmap, x, y, leftarrows.width, height, _INTL(" << "), shadowtext(bitmap, x, y, leftarrows.width, height, _INTL("<<"),
self.disabled || self.curvalue == self.minvalue) self.disabled || self.curvalue == self.minvalue)
@leftarrow = Rect.new(x, y, leftarrows.width, height) @leftarrow = Rect.new(x, y, leftarrows.width, height)
x += leftarrows.width x += leftarrows.width
@@ -695,7 +695,7 @@ class TextSlider < UIControl
shadowtext(bitmap, x, y, @maxoptionwidth, height, " #{@options[self.curvalue]} ", false, 1) shadowtext(bitmap, x, y, @maxoptionwidth, height, " #{@options[self.curvalue]} ", false, 1)
end end
x += @maxoptionwidth x += @maxoptionwidth
shadowtext(bitmap, x, y, rightarrows.width, height, _INTL(" >> "), shadowtext(bitmap, x, y, rightarrows.width, height, _INTL(">>"),
self.disabled || self.curvalue == self.maxvalue) self.disabled || self.curvalue == self.maxvalue)
@rightarrow = Rect.new(x, y, rightarrows.width, height) @rightarrow = Rect.new(x, y, rightarrows.width, height)
end end

View File

@@ -1088,20 +1088,58 @@ MenuHandlers.add(:debug_menu, :mystery_gift, {
}) })
MenuHandlers.add(:debug_menu, :extract_text, { MenuHandlers.add(:debug_menu, :extract_text, {
"name" => _INTL("Extract Text"), "name" => _INTL("Extract Text For Translation"),
"parent" => :other_menu, "parent" => :other_menu,
"description" => _INTL("Extract all text in the game to a single file for translating."), "description" => _INTL("Extract all text in the game to text files for translating."),
"effect" => proc { "effect" => proc {
pbExtractText if Settings::LANGUAGES.length == 0
pbMessage(_INTL("No languages are defined in the LANGUAGES array in Settings."))
pbMessage(_INTL("You need to add at least one language to LANGUAGES first, to choose which one to extract text for."))
next
end
# Choose a language from Settings to name the extraction folder after
cmds = []
Settings::LANGUAGES.each { |val| cmds.push(val[0]) }
cmds.push(_INTL("Cancel"))
language_index = pbMessage(_INTL("Choose a language to extract text for."), cmds, cmds.length)
next if language_index == cmds.length - 1
language_name = Settings::LANGUAGES[language_index][1]
# Choose whether to extract core text or game text
text_type = pbMessage(_INTL("Choose a language to extract text for."),
[_INTL("Game-specific text"), _INTL("Core text"), _INTL("Cancel")], 3)
next if text_type == 2
# If game text, choose whether to extract map texts to map-specific files or
# to one big file
map_files = 0
if text_type == 0
map_files = pbMessage(_INTL("How many text files should map event texts be extracted to?"),
[_INTL("One big file"), _INTL("One file per map"), _INTL("Cancel")], 3)
next if map_files == 2
end
# Extract the chosen set of text for the chosen language
Translator.extract_text(language_name, text_type == 1, map_files == 1)
} }
}) })
MenuHandlers.add(:debug_menu, :compile_text, { MenuHandlers.add(:debug_menu, :compile_text, {
"name" => _INTL("Compile Text"), "name" => _INTL("Compile Translated Text"),
"parent" => :other_menu, "parent" => :other_menu,
"description" => _INTL("Import text and converts it into a language file."), "description" => _INTL("Import text files and convert them into a language file."),
"effect" => proc { "effect" => proc {
pbCompileTextUI # Find all folders with a particular naming convention
cmds = Dir.glob("Text_*_*")
if cmds.length == 0
pbMessage(_INTL("No language folders found to compile."))
pbMessage(_INTL("Language folders must be named \"Text_SOMETHING_core\" or \"Text_SOMETHING_game\" and be in the root folder."))
next
end
cmds.push(_INTL("Cancel"))
# Ask which folder to compile into a .dat file
folder_index = pbMessage(_INTL("Choose a language folder to compile."), cmds, cmds.length)
next if folder_index == cmds.length - 1
# Compile the text files in the chosen folder
dat_filename = cmds[folder_index].gsub!(/^Text_/, "")
Translator.compile_text(cmds[folder_index], dat_filename)
} }
}) })

View File

@@ -546,37 +546,6 @@ end
#===============================================================================
# Text import/export for localisation
#===============================================================================
def pbExtractText
msgwindow = pbCreateMessageWindow
if safeExists?("intl.txt") &&
!pbConfirmMessageSerious(_INTL("intl.txt already exists. Overwrite it?"))
pbDisposeMessageWindow(msgwindow)
return
end
pbMessageDisplay(msgwindow, _INTL("Please wait.\\wtnp[0]"))
MessageTypes.extract("intl.txt")
pbMessageDisplay(msgwindow, _INTL("All text in the game was extracted and saved to intl.txt.\1"))
pbMessageDisplay(msgwindow, _INTL("To localize the text for a particular language, translate every second line in the file.\1"))
pbMessageDisplay(msgwindow, _INTL("After translating, choose \"Compile Text.\""))
pbDisposeMessageWindow(msgwindow)
end
def pbCompileTextUI
msgwindow = pbCreateMessageWindow
pbMessageDisplay(msgwindow, _INTL("Please wait.\\wtnp[0]"))
begin
pbCompileText
pbMessageDisplay(msgwindow, _INTL("Successfully compiled text and saved it to intl.dat.\1"))
pbMessageDisplay(msgwindow, _INTL("To use the file in a game, place the file in the Data folder under a different name, and edit the Settings::LANGUAGES array in the scripts."))
rescue RuntimeError
pbMessageDisplay(msgwindow, _INTL("Failed to compile text: {1}", $!.message))
end
pbDisposeMessageWindow(msgwindow)
end
#=============================================================================== #===============================================================================
# Battle animations import/export # Battle animations import/export
#=============================================================================== #===============================================================================

View File

@@ -151,7 +151,7 @@ module Compiler
} }
end end
# Unused # Used by translated text compiler
def pbEachSection(f) def pbEachSection(f)
lineno = 1 lineno = 1
havesection = false havesection = false
@@ -164,21 +164,21 @@ module Compiler
line.force_encoding(Encoding::UTF_8) line.force_encoding(Encoding::UTF_8)
if !line[/^\#/] && !line[/^\s*$/] if !line[/^\#/] && !line[/^\s*$/]
if line[/^\s*\[\s*(.+?)\s*\]\s*$/] if line[/^\s*\[\s*(.+?)\s*\]\s*$/]
yield lastsection, sectionname if havesection yield lastsection, sectionname if havesection
lastsection.clear
sectionname = $~[1] sectionname = $~[1]
lastsection = []
havesection = true havesection = true
else else
if sectionname.nil? if sectionname.nil?
raise _INTL("Expected a section at the beginning of the file (line {1}). Sections begin with '[name of section]'", lineno) raise _INTL("Expected a section at the beginning of the file (line {1}). Sections begin with '[name of section]'.", lineno)
end end
lastsection.push(line.gsub(/^\s+/, "").gsub(/\s+$/, "")) lastsection.push(line.strip)
end end
end end
lineno += 1 lineno += 1
Graphics.update if lineno % 500 == 0 Graphics.update if lineno % 500 == 0
} }
yield lastsection, sectionname if havesection yield lastsection, sectionname if havesection
end end
# Unused # Unused
@@ -845,9 +845,9 @@ module Compiler
compile_animations compile_animations
compile_trainer_events(mustCompile) compile_trainer_events(mustCompile)
Console.echo_li(_INTL("Saving messages...")) Console.echo_li(_INTL("Saving messages..."))
pbSetTextMessages Translator.gather_script_and_event_texts
MessageTypes.saveMessages MessageTypes.save_default_messages
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat") MessageTypes.load_default_messages if safeExists?("Data/messages_core.dat")
Console.echo_done(true) Console.echo_done(true)
Console.echo_li(_INTL("Reloading cache...")) Console.echo_li(_INTL("Reloading cache..."))
System.reload_cache System.reload_cache

View File

@@ -90,9 +90,9 @@ module Compiler
end end
point_names.uniq! point_names.uniq!
interest_names.uniq! interest_names.uniq!
MessageTypes.setMessages(MessageTypes::RegionNames, region_names) MessageTypes.setMessagesAsHash(MessageTypes::Regions, region_names)
MessageTypes.setMessagesAsHash(MessageTypes::PlaceNames, point_names) MessageTypes.setMessagesAsHash(MessageTypes::RegionLocations, point_names)
MessageTypes.setMessagesAsHash(MessageTypes::PlaceDescriptions, interest_names) MessageTypes.setMessagesAsHash(MessageTypes::RegionDescriptions, interest_names)
end end
#============================================================================= #=============================================================================
@@ -199,7 +199,7 @@ module Compiler
ability_descriptions.push(ability.real_description) ability_descriptions.push(ability.real_description)
end end
MessageTypes.setMessagesAsHash(MessageTypes::Abilities, ability_names) MessageTypes.setMessagesAsHash(MessageTypes::Abilities, ability_names)
MessageTypes.setMessagesAsHash(MessageTypes::AbilityDescs, ability_descriptions) MessageTypes.setMessagesAsHash(MessageTypes::AbilityDescriptions, ability_descriptions)
end end
#============================================================================= #=============================================================================
@@ -262,8 +262,8 @@ module Compiler
end end
MessageTypes.setMessagesAsHash(MessageTypes::Items, item_names) MessageTypes.setMessagesAsHash(MessageTypes::Items, item_names)
MessageTypes.setMessagesAsHash(MessageTypes::ItemPlurals, item_names_plural) MessageTypes.setMessagesAsHash(MessageTypes::ItemPlurals, item_names_plural)
MessageTypes.setMessagesAsHash(MessageTypes::ItemPortionNames, item_portion_names) MessageTypes.setMessagesAsHash(MessageTypes::ItemPortions, item_portion_names)
MessageTypes.setMessagesAsHash(MessageTypes::ItemPortionNamePlurals, item_portion_names_plural) MessageTypes.setMessagesAsHash(MessageTypes::ItemPortionPlurals, item_portion_names_plural)
MessageTypes.setMessagesAsHash(MessageTypes::ItemDescriptions, item_descriptions) MessageTypes.setMessagesAsHash(MessageTypes::ItemDescriptions, item_descriptions)
end end
@@ -370,9 +370,9 @@ module Compiler
species_pokedex_entries.push(species.real_pokedex_entry) species_pokedex_entries.push(species.real_pokedex_entry)
end end
MessageTypes.setMessagesAsHash(MessageTypes::Species, species_names) MessageTypes.setMessagesAsHash(MessageTypes::Species, species_names)
MessageTypes.setMessagesAsHash(MessageTypes::FormNames, species_form_names) MessageTypes.setMessagesAsHash(MessageTypes::SpeciesForms, species_form_names)
MessageTypes.setMessagesAsHash(MessageTypes::Kinds, species_categories) MessageTypes.setMessagesAsHash(MessageTypes::SpeciesCategories, species_categories)
MessageTypes.setMessagesAsHash(MessageTypes::Entries, species_pokedex_entries) MessageTypes.setMessagesAsHash(MessageTypes::PokedexEntries, species_pokedex_entries)
end end
#============================================================================= #=============================================================================
@@ -508,9 +508,9 @@ module Compiler
species_categories.push(species.real_category) species_categories.push(species.real_category)
species_pokedex_entries.push(species.real_pokedex_entry) species_pokedex_entries.push(species.real_pokedex_entry)
end end
MessageTypes.addMessagesAsHash(MessageTypes::FormNames, species_form_names) MessageTypes.addMessagesAsHash(MessageTypes::SpeciesForms, species_form_names)
MessageTypes.addMessagesAsHash(MessageTypes::Kinds, species_categories) MessageTypes.addMessagesAsHash(MessageTypes::SpeciesCategories, species_categories)
MessageTypes.addMessagesAsHash(MessageTypes::Entries, species_pokedex_entries) MessageTypes.addMessagesAsHash(MessageTypes::PokedexEntries, species_pokedex_entries)
end end
#============================================================================= #=============================================================================
@@ -908,7 +908,7 @@ module Compiler
lose_texts.push(trainer.real_lose_text) lose_texts.push(trainer.real_lose_text)
end end
MessageTypes.setMessagesAsHash(MessageTypes::TrainerNames, trainer_names) MessageTypes.setMessagesAsHash(MessageTypes::TrainerNames, trainer_names)
MessageTypes.setMessagesAsHash(MessageTypes::TrainerLoseText, lose_texts) MessageTypes.setMessagesAsHash(MessageTypes::TrainerLoseTexts, lose_texts)
end end
#============================================================================= #=============================================================================
@@ -932,9 +932,9 @@ module Compiler
} }
end end
sections = [] sections = []
MessageTypes.setMessagesAsHash(MessageTypes::BeginSpeech, []) MessageTypes.setMessagesAsHash(MessageTypes::FrontierIntroSpeeches, [])
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechWin, []) MessageTypes.setMessagesAsHash(MessageTypes::FrontierEndSpeechesWin, [])
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose, []) MessageTypes.setMessagesAsHash(MessageTypes::FrontierEndSpeechesLose, [])
File.open(path, "rb") { |f| File.open(path, "rb") { |f|
FileLineData.file = path FileLineData.file = path
idx = 0 idx = 0
@@ -1022,9 +1022,9 @@ module Compiler
} }
end end
MessageTypes.addMessagesAsHash(MessageTypes::TrainerNames, trainernames) MessageTypes.addMessagesAsHash(MessageTypes::TrainerNames, trainernames)
MessageTypes.addMessagesAsHash(MessageTypes::BeginSpeech, beginspeech) MessageTypes.addMessagesAsHash(MessageTypes::FrontierIntroSpeeches, beginspeech)
MessageTypes.addMessagesAsHash(MessageTypes::EndSpeechWin, endspeechwin) MessageTypes.addMessagesAsHash(MessageTypes::FrontierEndSpeechesWin, endspeechwin)
MessageTypes.addMessagesAsHash(MessageTypes::EndSpeechLose, endspeechlose) MessageTypes.addMessagesAsHash(MessageTypes::FrontierEndSpeechesLose, endspeechlose)
return sections return sections
end end
@@ -1153,7 +1153,7 @@ module Compiler
# Get map names for translating # Get map names for translating
map_names = [] map_names = []
GameData::MapMetadata.each { |map| map_names[map.id] = map.real_name } GameData::MapMetadata.each { |map| map_names[map.id] = map.real_name }
MessageTypes.setMessages(MessageTypes::MapNames, map_names) MessageTypes.setMessagesAsHash(MessageTypes::MapNames, map_names)
end end
#============================================================================= #=============================================================================

View File

@@ -24,7 +24,7 @@ end
def mainFunctionDebug def mainFunctionDebug
begin begin
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat") MessageTypes.load_default_messages if safeExists?("Data/messages_core.dat")
PluginManager.runPlugins PluginManager.runPlugins
Compiler.main Compiler.main
Game.initialize Game.initialize