From 64e84554d30b96b1edbd81c3eb157fa27a8d4e65 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 18 Feb 2023 13:46:01 +0100 Subject: [PATCH] Fix empty mission objectives getting translated --- mods/common/scripts/utils.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mods/common/scripts/utils.lua b/mods/common/scripts/utils.lua index 98cbb43b42..a7970cedd4 100644 --- a/mods/common/scripts/utils.lua +++ b/mods/common/scripts/utils.lua @@ -38,7 +38,11 @@ end ---@param description string key of the translation string ---@return number id used to query for the objective later AddPrimaryObjective = function(player, description) - local translation = UserInterface.Translate(description) + local translation = description + if translation ~= "" then + translation = UserInterface.Translate(description) + end + Media.DisplayMessageToPlayer(player, translation, UserInterface.Translate("new-primary-objective")) return player.AddObjective(translation, UserInterface.Translate("primary"), true) end @@ -48,7 +52,11 @@ end ---@param description string key of the translation string ---@return number id used to query for the objective later AddSecondaryObjective = function(player, description) - local translation = UserInterface.Translate(description) + local translation = description + if translation ~= "" then + translation = UserInterface.Translate(description) + end + Media.DisplayMessageToPlayer(player, translation, UserInterface.Translate("new-secondary-objective")) return player.AddObjective(translation, UserInterface.Translate("secondary"), false) end