Skip to content

Commit ae33da9

Browse files
committed
Platform independent string formatting.
1 parent 172f094 commit ae33da9

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Sources/NodeEngineTest/LocalizationTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ TEST (SimplePoFileWithFormatTest)
6363
std::wstring poContent = LR"(
6464
msgid "apple"
6565
msgstr "alma"
66-
msgid "this is an %s"
67-
msgstr "ez itt egy %s"
66+
msgid "this is an %ls"
67+
msgstr "ez itt egy %ls"
6868
)";
6969
Dictionary dictionary;
7070
PoDictionarySource poDictionarySource (poContent);
7171
ASSERT (FillDictionary (dictionary, poDictionarySource));
7272
ASSERT (dictionary.GetLocalizedString (L"apple") == L"alma");
73-
ASSERT (FormatString (dictionary.GetLocalizedString (L"this is an %s"), dictionary.GetLocalizedString (L"apple").c_str ()) == L"ez itt egy alma");
73+
ASSERT (FormatString (dictionary.GetLocalizedString (L"this is an %ls"), dictionary.GetLocalizedString (L"apple").c_str ()) == L"ez itt egy alma");
7474
}
7575

7676
TEST (SimplePoFileWithInvalidFormatTest)

Sources/NodeUIEngine/NUIE_NodeMenuCommands.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ class AddNodesToGroupMenuCommand : public SingleMenuCommand
695695
{
696696
public:
697697
AddNodesToGroupMenuCommand (NodeUIManager& uiManager, const UINodeGroupPtr& uiNodeGroup, const NE::NodeCollection& relevantNodes) :
698-
SingleMenuCommand (NE::FormatString (NE::Localize (L"Add To Group \"%s\""), uiNodeGroup->GetName ().c_str ()), false),
698+
SingleMenuCommand (NE::FormatString (NE::Localize (L"Add To Group \"%ls\""), uiNodeGroup->GetName ().c_str ()), false),
699699
uiManager (uiManager),
700700
uiNodeGroup (uiNodeGroup),
701701
relevantNodes (relevantNodes)
@@ -895,7 +895,7 @@ MenuCommandStructure CreateOutputSlotCommandStructure (NodeUIManager& uiManager,
895895
OutputSlotGroupCommandPtr disconnectGroup (new NodeGroupCommand<OutputSlotCommandPtr> (NE::Localize (L"Disconnect")));
896896
uiManager.EnumerateConnectedInputSlots (outputSlot, [&] (UIInputSlotConstPtr inputSlot) {
897897
UINodeConstPtr uiNode = uiManager.GetUINode (inputSlot->GetOwnerNodeId ());
898-
std::wstring disconnectCommandName = NE::FormatString (L"%s (%s)", uiNode->GetNodeName ().c_str (), inputSlot->GetName ().c_str ());
898+
std::wstring disconnectCommandName = NE::FormatString (L"%ls (%ls)", uiNode->GetNodeName ().c_str (), inputSlot->GetName ().c_str ());
899899
disconnectGroup->AddChildCommand (OutputSlotCommandPtr (new DisconnectFromOutputSlotMenuCommand (disconnectCommandName, inputSlot)));
900900
});
901901
disconnectGroup->AddChildCommand (OutputSlotCommandPtr (new DisconnectAllFromOutputSlotMenuCommand (NE::Localize (L"All"))));
@@ -914,7 +914,7 @@ MenuCommandStructure CreateInputSlotCommandStructure (NodeUIManager& uiManager,
914914
InputSlotGroupCommandPtr disconnectGroup (new NodeGroupCommand<InputSlotCommandPtr> (NE::Localize (L"Disconnect")));
915915
uiManager.EnumerateConnectedOutputSlots (inputSlot, [&] (UIOutputSlotConstPtr outputSlot) {
916916
UINodeConstPtr uiNode = uiManager.GetUINode (outputSlot->GetOwnerNodeId ());
917-
std::wstring disconnectCommandName = NE::FormatString (L"%s (%s)", uiNode->GetNodeName ().c_str (), outputSlot->GetName ().c_str ());
917+
std::wstring disconnectCommandName = NE::FormatString (L"%ls (%ls)", uiNode->GetNodeName ().c_str (), outputSlot->GetName ().c_str ());
918918
disconnectGroup->AddChildCommand (InputSlotCommandPtr (new DisconnectFromInputSlotMenuCommand (disconnectCommandName, outputSlot)));
919919
});
920920
disconnectGroup->AddChildCommand (InputSlotCommandPtr (new DisconnectAllFromInputSlotMenuCommand (NE::Localize (L"All"))));

0 commit comments

Comments
 (0)