Skip to content

Commit

Permalink
Rename localization enum values.
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacsv committed Jun 13, 2020
1 parent 2ecd355 commit 01bd9ea
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions Sources/NodeEngine/NE_LocString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LocString::LocString () :
}

LocString::LocString (const std::wstring& strValue) :
LocString (strValue, Localization::Localizable)
LocString (strValue, Localization::Localize)
{
}

Expand All @@ -23,18 +23,18 @@ LocString::LocString (const std::wstring& strValue, Localization localization) :

void LocString::SetCustom (const std::wstring& customValue)
{
if (localization == Localization::Localizable && customValue == GetLocalized ()) {
if (localization == Localization::Localize && customValue == GetLocalized ()) {
return;
}
strValue = customValue;
localization = Localization::NonLocalizable;
localization = Localization::DoNotLocalize;
}

std::wstring LocString::GetLocalized () const
{
if (localization == Localization::Localizable) {
if (localization == Localization::Localize) {
return LocalizeString (strValue);
} else if (localization == Localization::NonLocalizable){
} else if (localization == Localization::DoNotLocalize){
return strValue;
}
DBGBREAK ();
Expand All @@ -43,9 +43,9 @@ std::wstring LocString::GetLocalized () const

std::wstring LocString::GetLocalized (const Dictionary& dictionary) const
{
if (localization == Localization::Localizable) {
if (localization == Localization::Localize) {
return LocalizeString (dictionary, strValue);
} else if (localization == Localization::NonLocalizable) {
} else if (localization == Localization::DoNotLocalize) {
return strValue;
}
DBGBREAK ();
Expand Down
4 changes: 2 additions & 2 deletions Sources/NodeEngine/NE_LocString.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class LocString
public:
enum class Localization
{
Localizable = 1,
NonLocalizable = 2
Localize = 1,
DoNotLocalize = 2
};

explicit LocString ();
Expand Down
2 changes: 1 addition & 1 deletion Sources/NodeEngineTest/LocalizationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ TEST (StringLocalizationTest)
ASSERT (FillDictionary (dictionary, poDictionarySource));

LocString appleString (L"apple");
LocString appleNonLocString (L"apple", LocString::Localization::NonLocalizable);
LocString appleNonLocString (L"apple", LocString::Localization::DoNotLocalize);
LocString lemonString (L"lemon");

ASSERT (appleString.GetLocalized (dictionary) == L"alma");
Expand Down
10 changes: 5 additions & 5 deletions Sources/NodeUIEngine/NUIE_NodeCommonMenuCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ class NodeCommandStructureBuilder : public NodeCommandRegistrator

virtual void RegisterNodeGroupCommand (NodeGroupCommandPtr nodeGroupCommand) override
{
NE::LocString menuCommandName (nodeGroupCommand->GetName (), NE::LocString::Localization::NonLocalizable);
NE::LocString menuCommandName (nodeGroupCommand->GetName (), NE::LocString::Localization::DoNotLocalize);
MultiMenuCommandPtr multiCommand (new MultiMenuCommand (menuCommandName));
nodeGroupCommand->EnumerateChildCommands ([&] (const NodeCommandPtr& nodeCommand) {
std::shared_ptr<MultiNodeMenuCommand> multiNodeCommand = CreateMultiNodeCommand (nodeCommand);
Expand All @@ -626,7 +626,7 @@ class NodeCommandStructureBuilder : public NodeCommandRegistrator
private:
std::shared_ptr<MultiNodeMenuCommand> CreateMultiNodeCommand (NodeCommandPtr nodeCommand)
{
NE::LocString menuCommandName (nodeCommand->GetName (), NE::LocString::Localization::NonLocalizable);
NE::LocString menuCommandName (nodeCommand->GetName (), NE::LocString::Localization::DoNotLocalize);
std::shared_ptr<MultiNodeMenuCommand> multiNodeCommand (new MultiNodeMenuCommand (menuCommandName, uiManager, uiEnvironment, nodeCommand));
relevantNodes.Enumerate ([&] (const NE::NodeId& nodeId) {
UINodePtr uiNode = uiManager.GetUINode (nodeId);
Expand All @@ -641,7 +641,7 @@ class NodeCommandStructureBuilder : public NodeCommandRegistrator
NodeUIManager& uiManager;
NodeUIEnvironment& uiEnvironment;
const NE::NodeCollection& relevantNodes;
MenuCommandStructure commandStructure;
MenuCommandStructure commandStructure;
};

template <typename SlotType, typename CommandType>
Expand Down Expand Up @@ -699,7 +699,7 @@ class SlotCommandStructureBuilder : public RegistratorType

virtual void RegisterSlotGroupCommand (std::shared_ptr<NodeGroupCommand<SlotCommandType>> slotGroupCommand) override
{
NE::LocString menuCommandName (slotGroupCommand->GetName (), NE::LocString::Localization::NonLocalizable);
NE::LocString menuCommandName (slotGroupCommand->GetName (), NE::LocString::Localization::DoNotLocalize);
MultiMenuCommandPtr multiCommand (new MultiMenuCommand (menuCommandName));
slotGroupCommand->EnumerateChildCommands ([&] (const SlotCommandType& slotNodeCommand) {
MenuCommandPtr slotCommand = CreateSlotCommand (slotNodeCommand);
Expand All @@ -710,7 +710,7 @@ class SlotCommandStructureBuilder : public RegistratorType

MenuCommandPtr CreateSlotCommand (SlotCommandType slotNodeCommand)
{
NE::LocString menuCommandName (slotNodeCommand->GetName (), NE::LocString::Localization::NonLocalizable);
NE::LocString menuCommandName (slotNodeCommand->GetName (), NE::LocString::Localization::DoNotLocalize);
MenuCommandPtr slotCommand (new SlotMenuCommand<SourceSlotType, SlotCommandType> (menuCommandName, uiManager, uiEnvironment, sourceSlot, slotNodeCommand));
return slotCommand;
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/WindowsEmbeddingDemo2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ class MyEventHandler : public WAS::HwndEventHandler

NUIE::MenuCommandStructure finalCommands = commands;
for (const WAS::NodeTree::Group& group : nodeTree.GetGroups ()) {
NE::LocString groupMenuCommandName (group.GetName (), NE::LocString::Localization::NonLocalizable);
NE::LocString groupMenuCommandName (group.GetName (), NE::LocString::Localization::DoNotLocalize);
NUIE::MultiMenuCommandPtr multiCommand (new NUIE::MultiMenuCommand (groupMenuCommandName));
for (const WAS::NodeTree::Item& item : group.GetItems ()) {
NE::LocString menuCommandName (item.GetName (), NE::LocString::Localization::NonLocalizable);
NE::LocString menuCommandName (item.GetName (), NE::LocString::Localization::DoNotLocalize);
multiCommand->AddChildCommand (NUIE::MenuCommandPtr (new CreateNodeCommand (nodeEditor, menuCommandName, position, item.GetCreator ())));
}
finalCommands.AddCommand (multiCommand);
Expand Down

0 comments on commit 01bd9ea

Please sign in to comment.