(38d8117f7) Added: More routing of TextManager.Get().Replace -> TextManager.GetWithVariable(s), missing workshop-related localization tags to englishvanilla

This commit is contained in:
Joonas Rikkonen
2019-06-04 15:38:12 +03:00
parent 822322e669
commit f797235bfd
66 changed files with 332 additions and 302 deletions
@@ -121,8 +121,7 @@ namespace Barotrauma
if (!hasRequiredContentPackages)
{
var msgBox = new GUIMessageBox(TextManager.Get("ContentPackageMismatch"),
TextManager.Get("ContentPackageMismatchWarning")
.Replace("[requiredcontentpackages]", string.Join(", ", selectedSub.RequiredContentPackages)),
TextManager.GetWithVariable("ContentPackageMismatchWarning", "[requiredcontentpackages]", string.Join(", ", selectedSub.RequiredContentPackages)),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
msgBox.Buttons[0].OnClicked = msgBox.Close;
@@ -636,7 +636,7 @@ namespace Barotrauma
CanBeFocused = false
};
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), container.RectTransform),
TextManager.Get("Reward").Replace("[reward]", selectedMission.Reward.ToString()))
TextManager.GetWithVariable("Reward", "[reward]", selectedMission.Reward.ToString()))
{
CanBeFocused = false
};
@@ -860,8 +860,7 @@ namespace Barotrauma
public string GetMoney()
{
return TextManager.Get("PlayerCredits").Replace("[credits]",
((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", Campaign.Money)));
return TextManager.GetWithVariable("PlayerCredits", "[credits]", (GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", Campaign.Money));
}
private bool SelectCharacter(GUIComponent component, object selection)
@@ -902,7 +901,7 @@ namespace Barotrauma
{
var confirmDialog = new GUIMessageBox(
TextManager.Get("FireWarningHeader"),
TextManager.Get("FireWarningText").Replace("[charactername]", ((CharacterInfo)obj).Name),
TextManager.GetWithVariable("FireWarningText", "[charactername]", ((CharacterInfo)obj).Name),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
confirmDialog.Buttons[0].UserData = (CharacterInfo)obj;
confirmDialog.Buttons[0].OnClicked = FireCharacter;
@@ -9,6 +9,7 @@ namespace Barotrauma
private GUIListBox listBox;
private XElement configElement;
private RectTransform parent;
private float scrollSpeed;
@@ -277,7 +277,7 @@ namespace Barotrauma
Stretch = true
};
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), commonnessContainer.RectTransform),
TextManager.Get("LevelEditorLevelObjCommonness").Replace("[leveltype]", selectedParams.Name), textAlignment: Alignment.Center);
TextManager.GetWithVariable("LevelEditorLevelObjCommonness", "[leveltype]", selectedParams.Name), textAlignment: Alignment.Center);
new GUINumberInput(new RectTransform(new Vector2(0.5f, 0.4f), commonnessContainer.RectTransform), GUINumberInput.NumberType.Float)
{
MinValueFloat = 0,
@@ -1986,16 +1986,17 @@ namespace Barotrauma
string errorMsg = "";
if (sub == null)
{
errorMsg = TextManager.Get("SubNotFoundError").Replace("[subname]", subName) + " ";
errorMsg = TextManager.GetWithVariable("SubNotFoundError", "[subname]", subName) + " ";
}
else if (sub.MD5Hash.Hash == null)
{
errorMsg = TextManager.Get("SubLoadError").Replace("[subname]", subName) + " ";
errorMsg = TextManager.GetWithVariable("SubLoadError", "[subname]", subName) + " ";
if (matchingListSub != null) matchingListSub.GetChild<GUITextBox>().TextColor = Color.Red;
}
else
{
errorMsg = TextManager.Get("SubDoesntMatchError").Replace("[subname]", sub.Name).Replace("[myhash]", sub.MD5Hash.ShortHash).Replace("[serverhash]", Md5Hash.GetShortHash(md5Hash)) + " ";
errorMsg = TextManager.GetWithVariables("SubDoesntMatchError", new string[3] { "[subname]" , "[myhash]", "[serverhash]" },
new string[3] { sub.Name, sub.MD5Hash.ShortHash, Md5Hash.GetShortHash(md5Hash) }) + " ";
}
errorMsg += TextManager.Get("DownloadSubQuestion");
@@ -217,6 +217,22 @@ namespace Barotrauma
return true;
}
private bool RefreshJoinButtonState(GUIComponent component, object obj)
{
if (obj == null || waitingForRefresh) { return false; }
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
{
joinButton.Enabled = true;
}
else
{
joinButton.Enabled = false;
}
return true;
}
private bool SelectServer(GUIComponent component, object obj)
{
if (obj == null || waitingForRefresh || (!(obj is ServerInfo))) { return false; }
@@ -469,16 +485,14 @@ namespace Barotrauma
{
string toolTip = "";
if (serverInfo.GameVersion != GameMain.Version.ToString())
toolTip = TextManager.Get("ServerListIncompatibleVersion").Replace("[version]", serverInfo.GameVersion);
toolTip = TextManager.GetWithVariable("ServerListIncompatibleVersion", "[version]", serverInfo.GameVersion);
for (int i = 0; i < serverInfo.ContentPackageNames.Count; i++)
{
if (!GameMain.SelectedPackages.Any(cp => cp.MD5hash.Hash == serverInfo.ContentPackageHashes[i]))
{
if (toolTip != "") toolTip += "\n";
toolTip += TextManager.Get("ServerListIncompatibleContentPackage")
.Replace("[contentpackage]", serverInfo.ContentPackageNames[i])
.Replace("[hash]", Md5Hash.GetShortHash(serverInfo.ContentPackageHashes[i]));
toolTip += TextManager.GetWithVariables("ServerListIncompatibleContentPackage", new string[2] { "[contentpackage]", "[hash]" }, new string[2] { serverInfo.ContentPackageNames[i], Md5Hash.GetShortHash(serverInfo.ContentPackageHashes[i]) });
}
}
@@ -542,7 +556,7 @@ namespace Barotrauma
if (masterServerResponse.ErrorException != null)
{
serverList.ClearChildren();
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.Get("MasterServerErrorException").Replace("[error]", masterServerResponse.ErrorException.ToString()));
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.GetWithVariable("MasterServerErrorException", "[error]", masterServerResponse.ErrorException.ToString()));
}
else if (masterServerResponse.StatusCode != System.Net.HttpStatusCode.OK)
{
@@ -552,24 +566,16 @@ namespace Barotrauma
{
case System.Net.HttpStatusCode.NotFound:
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
TextManager.Get("MasterServerError404")
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
TextManager.GetWithVariable("MasterServerError404", "[masterserverurl]", NetConfig.MasterServerUrl));
break;
case System.Net.HttpStatusCode.ServiceUnavailable:
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
TextManager.Get("MasterServerErrorUnavailable")
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
TextManager.Get("MasterServerErrorUnavailable"));
break;
default:
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
TextManager.Get("MasterServerError404")
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
TextManager.GetWithVariables("MasterServerErrorDefault", new string[2] { "[statuscode]", "[statusdescription]" },
new string[2] { masterServerResponse.StatusCode.ToString(), masterServerResponse.StatusDescription }));
break;
}
@@ -415,14 +415,14 @@ namespace Barotrauma
{
if (SteamManager.UpdateWorkshopItem(item, out string errorMsg))
{
new GUIMessageBox("", TextManager.Get("WorkshopItemUpdated").Replace("[itemname]", TextManager.EnsureUTF8(item.Title)));
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", TextManager.EnsureUTF8(item.Title)));
}
else
{
DebugConsole.ThrowError(errorMsg);
new GUIMessageBox(
TextManager.Get("Error"),
TextManager.Get("WorkshopItemUpdateFailed").Replace("[itemname]", TextManager.EnsureUTF8(item.Title)).Replace("[errormessage]", errorMsg));
TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { TextManager.EnsureUTF8(item.Title), errorMsg }));
}
btn.Enabled = false;
btn.Visible = false;
@@ -733,7 +733,7 @@ namespace Barotrauma
new GUIImage(new RectTransform(new Point(scoreContainer.Rect.Height), scoreContainer.RectTransform),
i < starCount ? "GUIStarIconBright" : "GUIStarIconDark");
}
new GUITextBlock(new RectTransform(new Vector2(0.2f, 0.0f), scoreContainer.RectTransform), TextManager.Get("WorkshopItemVotes").Replace("[votecount]", (item.VotesUp + item.VotesDown).ToString()));
new GUITextBlock(new RectTransform(new Vector2(0.2f, 0.0f), scoreContainer.RectTransform), TextManager.GetWithVariable("WorkshopItemVotes", "[votecount]", (item.VotesUp + item.VotesDown).ToString()));
//tags ------------------------------------
var tagContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.05f), content.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft)
@@ -857,7 +857,7 @@ namespace Barotrauma
if (!item.Installed)
{
new GUIMessageBox(TextManager.Get("Error"),
TextManager.Get("WorkshopErrorInstallRequiredToEdit").Replace("[itemname]", TextManager.EnsureUTF8(item.Title)));
TextManager.GetWithVariable("WorkshopErrorInstallRequiredToEdit", "[itemname]", TextManager.EnsureUTF8(item.Title)));
return;
}
SteamManager.CreateWorkshopItemStaging(item, out itemEditor, out itemContentPackage);
@@ -1025,9 +1025,8 @@ namespace Barotrauma
{
new GUIMessageBox(
TextManager.Get("Error"),
TextManager.Get("ContentPackageCantMakeCorePackage")
.Replace("[packagename]", itemContentPackage.Name)
.Replace("[missingfiletypes]", string.Join(", ", missingContentTypes)));
TextManager.GetWithVariables("ContentPackageCantMakeCorePackage", new string[2] { "[packagename]", "[missingfiletypes]" },
new string[2] { itemContentPackage.Name, string.Join(", ", missingContentTypes) }, new bool[2] { false, true }));
tickbox.Selected = false;
}
else
@@ -1154,7 +1153,7 @@ namespace Barotrauma
OnClicked = (btn, userData) =>
{
if (itemEditor == null) { return false; }
var deleteVerification = new GUIMessageBox("", TextManager.Get("WorkshopItemDeleteVerification").Replace("[itemname]", itemEditor.Title),
var deleteVerification = new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemDeleteVerification", "[itemname]", itemEditor.Title),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
deleteVerification.Buttons[0].OnClicked = (yesBtn, userdata) =>
{
@@ -1356,7 +1355,7 @@ namespace Barotrauma
string pleaseWaitText = TextManager.Get("WorkshopPublishPleaseWait");
var msgBox = new GUIMessageBox(
pleaseWaitText,
TextManager.Get("WorkshopPublishInProgress").Replace("[itemname]", TextManager.EnsureUTF8(item.Title)),
TextManager.GetWithVariable("WorkshopPublishInProgress", "[itemname]", TextManager.EnsureUTF8(item.Title)),
new string[] { TextManager.Get("Cancel") });
msgBox.Buttons[0].OnClicked = (btn, userdata) =>
@@ -1378,13 +1377,13 @@ namespace Barotrauma
if (string.IsNullOrEmpty(item.Error))
{
new GUIMessageBox("", TextManager.Get("WorkshopItemPublished").Replace("[itemname]", TextManager.EnsureUTF8(item.Title)));
new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemPublished", "[itemname]", TextManager.EnsureUTF8(item.Title)));
}
else
{
new GUIMessageBox(
TextManager.Get("Error"),
TextManager.Get("WorkshopItemPublishFailed").Replace("[itemname]", TextManager.EnsureUTF8(item.Title)) + item.Error);
TextManager.GetWithVariable("WorkshopItemPublishFailed", "[itemname]", TextManager.EnsureUTF8(item.Title)) + item.Error);
}
createItemFrame.ClearChildren();
@@ -115,7 +115,7 @@ namespace Barotrauma
{
if (buoyancyVol / selectedVol < 1.0f)
{
retVal += " (" + TextManager.Get("OptimalBallastLevel").Replace("[value]", (buoyancyVol / selectedVol).ToString("0.000")) + ")";
retVal += " (" + TextManager.GetWithVariable("OptimalBallastLevel", "[value]", (buoyancyVol / selectedVol).ToString("0.000")) + ")";
}
else
{
@@ -572,7 +572,7 @@ namespace Barotrauma
ItemAssemblyPrefab assemblyPrefab = userData as ItemAssemblyPrefab;
var msgBox = new GUIMessageBox(
TextManager.Get("DeleteDialogLabel"),
TextManager.Get("DeleteDialogQuestion").Replace("[file]", assemblyPrefab.Name),
TextManager.GetWithVariable("DeleteDialogQuestion", "[file]", assemblyPrefab.Name),
new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
msgBox.Buttons[0].OnClicked += (deleteBtn, userData2) =>
{
@@ -584,7 +584,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError(TextManager.Get("DeleteFileError").Replace("[file]", assemblyPrefab.Name), e);
DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", assemblyPrefab.Name), e);
}
return true;
};
@@ -861,7 +861,7 @@ namespace Barotrauma
{
if (nameBox.Text.Contains(illegalChar))
{
GUI.AddMessage(TextManager.Get("SubNameIllegalCharsWarning").Replace("[illegalchar]", illegalChar.ToString()), Color.Red);
GUI.AddMessage(TextManager.GetWithVariable("SubNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), Color.Red);
nameBox.Flash();
return false;
}
@@ -907,7 +907,7 @@ namespace Barotrauma
}
Submarine.MainSub.CheckForErrors();
GUI.AddMessage(TextManager.Get("SubSavedNotification").Replace("[filepath]", Submarine.MainSub.FilePath), Color.Green);
GUI.AddMessage(TextManager.GetWithVariable("SubSavedNotification", "[filepath]", Submarine.MainSub.FilePath), Color.Green);
Submarine.RefreshSavedSub(savePath);
if (prevSavePath != null && prevSavePath != savePath)
@@ -1259,7 +1259,7 @@ namespace Barotrauma
{
if (nameBox.Text.Contains(illegalChar))
{
GUI.AddMessage(TextManager.Get("ItemAssemblyNameIllegalCharsWarning").Replace("[illegalchar]", illegalChar.ToString()), Color.Red);
GUI.AddMessage(TextManager.GetWithVariable("ItemAssemblyNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), Color.Red);
nameBox.Flash();
return false;
}
@@ -1476,7 +1476,7 @@ namespace Barotrauma
var msgBox = new GUIMessageBox(
TextManager.Get("DeleteDialogLabel"),
TextManager.Get("DeleteDialogQuestion").Replace("[file]", sub.Name),
TextManager.GetWithVariable("DeleteDialogQuestion", "[file]", sub.Name),
new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
msgBox.Buttons[0].OnClicked += (btn, userData) =>
{
@@ -1489,7 +1489,7 @@ namespace Barotrauma
}
catch (Exception e)
{
DebugConsole.ThrowError(TextManager.Get("DeleteFileError").Replace("[file]", sub.FilePath), e);
DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", sub.FilePath), e);
}
return true;
};