package vn import ( "fmt" "os" "gopkg.in/yaml.v3" ) // Texts contains all user-facing strings loaded from YAML. type Texts struct { EndText string `yaml:"end_text"` EngineErrorSpeaker string `yaml:"engine_error_speaker"` CharacterLabelFmt string `yaml:"character_label_fmt"` LoadingTitle string `yaml:"loading_title"` LoadingMessage string `yaml:"loading_message"` LoadingWait string `yaml:"loading_wait"` TitleSubtitle string `yaml:"title_subtitle"` TitleMenuStart string `yaml:"title_menu_start"` TitleMenuLoad string `yaml:"title_menu_load"` TitleMenuQuit string `yaml:"title_menu_quit"` TitleControls string `yaml:"title_controls"` TitleControls2 string `yaml:"title_controls_2"` HintAdvance string `yaml:"hint_advance"` HintEnded string `yaml:"hint_ended"` StoryControls1 string `yaml:"story_controls_1"` StoryControls2 string `yaml:"story_controls_2"` NoticeNewGame string `yaml:"notice_new_game"` NoticeLoaded string `yaml:"notice_loaded"` NoticeSaved string `yaml:"notice_saved"` NoticeLoadFailed string `yaml:"notice_load_failed"` NoticeSaveFailed string `yaml:"notice_save_failed"` NoticeJumpFailed string `yaml:"notice_jump_failed"` NoticeJumped string `yaml:"notice_jumped"` NoticeDebugOn string `yaml:"notice_debug_on"` NoticeDebugOff string `yaml:"notice_debug_off"` FlightCheckPassed string `yaml:"flight_check_passed"` FlightCheckOneFmt string `yaml:"flight_check_one_fmt"` FlightCheckManyFmt string `yaml:"flight_check_many_fmt"` FlightMissingScriptFmt string `yaml:"flight_missing_script_fmt"` FlightDuplicateSceneFmt string `yaml:"flight_duplicate_scene_fmt"` FlightStartMissingFmt string `yaml:"flight_start_missing_fmt"` FlightGotoMissingFmt string `yaml:"flight_goto_missing_fmt"` FlightChoiceMissingFmt string `yaml:"flight_choice_missing_fmt"` FlightMissingAssetFmt string `yaml:"flight_missing_asset_fmt"` DebugHeader string `yaml:"debug_header"` DebugCurrentScene string `yaml:"debug_current_scene"` DebugJumpPrefix string `yaml:"debug_jump_prefix"` DebugJumpHelp string `yaml:"debug_jump_help"` DebugVariables string `yaml:"debug_variables"` DebugScenes string `yaml:"debug_scenes"` DebugMoreFmt string `yaml:"debug_more_fmt"` DebugVarFmt string `yaml:"debug_var_fmt"` ErrorBannerFmt string `yaml:"error_banner_fmt"` } func LoadTexts(path string) (*Texts, error) { data, err := os.ReadFile(path) if err != nil { return nil, fmt.Errorf("read texts: %w", err) } var t Texts if err := yaml.Unmarshal(data, &t); err != nil { return nil, fmt.Errorf("parse texts yaml: %w", err) } return &t, nil }