More localization fixes

This commit is contained in:
Tim Sarbin 2019-11-01 00:34:23 -04:00
parent da5baec685
commit 1494a4fb7b
5 changed files with 12 additions and 8 deletions

View File

@ -94,5 +94,5 @@ func LoadSounds(fileProvider FileProvider) {
} }
*/ */
} }
log.Println("Loaded %d sound definitions", len(Sounds)) log.Printf("Loaded %d sound definitions", len(Sounds))
} }

View File

@ -65,6 +65,10 @@ func Utf16BytesToString(b []byte) (string, error) {
return ret.String(), nil return ret.String(), nil
} }
func CombineStrings(input []string) string {
return strings.Join(input, "\n")
}
func SplitIntoLinesWithMaxWidth(fullSentence string, maxChars int) []string { func SplitIntoLinesWithMaxWidth(fullSentence string, maxChars int) []string {
lines := make([]string, 0) lines := make([]string, 0)
line := "" line := ""

View File

@ -45,31 +45,31 @@ func (v *CharacterSelect) Load() []func() {
v.background.MoveTo(0, 0) v.background.MoveTo(0, 0)
}, },
func() { func() {
v.newCharButton = UI.CreateButton(UI.ButtonTypeTall, v.fileProvider, "CREATE NEW\nCHARACTER") v.newCharButton = UI.CreateButton(UI.ButtonTypeTall, v.fileProvider, Common.CombineStrings(Common.SplitIntoLinesWithMaxWidth(Common.TranslateString("#831"), 13)))
v.newCharButton.MoveTo(33, 468) v.newCharButton.MoveTo(33, 468)
v.newCharButton.OnActivated(func() { v.onNewCharButtonClicked() }) v.newCharButton.OnActivated(func() { v.onNewCharButtonClicked() })
v.uiManager.AddWidget(v.newCharButton) v.uiManager.AddWidget(v.newCharButton)
}, },
func() { func() {
v.convertCharButton = UI.CreateButton(UI.ButtonTypeTall, v.fileProvider, "CONVERT TO\nEXPANSION") v.convertCharButton = UI.CreateButton(UI.ButtonTypeTall, v.fileProvider, Common.CombineStrings(Common.SplitIntoLinesWithMaxWidth(Common.TranslateString("#825"), 13)))
v.convertCharButton.MoveTo(233, 468) v.convertCharButton.MoveTo(233, 468)
v.convertCharButton.SetEnabled(false) v.convertCharButton.SetEnabled(false)
v.uiManager.AddWidget(v.convertCharButton) v.uiManager.AddWidget(v.convertCharButton)
}, },
func() { func() {
v.deleteCharButton = UI.CreateButton(UI.ButtonTypeTall, v.fileProvider, "DELETE\nCHARACTER") v.deleteCharButton = UI.CreateButton(UI.ButtonTypeTall, v.fileProvider, Common.CombineStrings(Common.SplitIntoLinesWithMaxWidth(Common.TranslateString("#832"), 13)))
v.deleteCharButton.MoveTo(433, 468) v.deleteCharButton.MoveTo(433, 468)
v.deleteCharButton.SetEnabled(false) v.deleteCharButton.SetEnabled(false)
v.uiManager.AddWidget(v.deleteCharButton) v.uiManager.AddWidget(v.deleteCharButton)
}, },
func() { func() {
v.exitButton = UI.CreateButton(UI.ButtonTypeMedium, v.fileProvider, "EXIT") v.exitButton = UI.CreateButton(UI.ButtonTypeMedium, v.fileProvider, Common.TranslateString("#970"))
v.exitButton.MoveTo(33, 537) v.exitButton.MoveTo(33, 537)
v.exitButton.OnActivated(func() { v.onExitButtonClicked() }) v.exitButton.OnActivated(func() { v.onExitButtonClicked() })
v.uiManager.AddWidget(v.exitButton) v.uiManager.AddWidget(v.exitButton)
}, },
func() { func() {
v.okButton = UI.CreateButton(UI.ButtonTypeMedium, v.fileProvider, "OK") v.okButton = UI.CreateButton(UI.ButtonTypeMedium, v.fileProvider, Common.TranslateString("#971"))
v.okButton.MoveTo(625, 537) v.okButton.MoveTo(625, 537)
v.okButton.SetEnabled(false) v.okButton.SetEnabled(false)
v.uiManager.AddWidget(v.okButton) v.uiManager.AddWidget(v.okButton)

View File

@ -56,7 +56,7 @@ func (v *Credits) Load() []func() {
v.creditsBackground.MoveTo(0, 0) v.creditsBackground.MoveTo(0, 0)
}, },
func() { func() {
v.exitButton = UI.CreateButton(UI.ButtonTypeMedium, v.fileProvider, "EXIT") v.exitButton = UI.CreateButton(UI.ButtonTypeMedium, v.fileProvider, Common.TranslateString("#970"))
v.exitButton.MoveTo(30, 550) v.exitButton.MoveTo(30, 550)
v.exitButton.OnActivated(func() { v.onExitButtonClicked() }) v.exitButton.OnActivated(func() { v.onExitButtonClicked() })
v.uiManager.AddWidget(v.exitButton) v.uiManager.AddWidget(v.exitButton)

View File

@ -109,7 +109,7 @@ func (v *SelectHeroClass) Load() []func() {
v.campfire.Animate = true v.campfire.Animate = true
}, },
func() { func() {
v.exitButton = UI.CreateButton(UI.ButtonTypeMedium, v.fileProvider, "EXIT") v.exitButton = UI.CreateButton(UI.ButtonTypeMedium, v.fileProvider, Common.TranslateString("#970"))
v.exitButton.MoveTo(33, 537) v.exitButton.MoveTo(33, 537)
v.exitButton.OnActivated(func() { v.onExitButtonClicked() }) v.exitButton.OnActivated(func() { v.onExitButtonClicked() })
v.uiManager.AddWidget(v.exitButton) v.uiManager.AddWidget(v.exitButton)