Skip to content

Commit

Permalink
All - Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Dec 25, 2023
1 parent da516e4 commit 484b12a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/helpers/stringhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace Nickvision::Aura::StringHelpers
* @param replace The new string to replace with
* @return The new replaced string
*/
std::string replace(std::string s, std::string toReplace, std::string replace);
std::string replace(std::string s, const std::string& toReplace, const std::string& replace);
/**
* @brief Generates a new guid value.
* @return The guid value
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/stringhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace Nickvision::Aura
return result;
}

std::string StringHelpers::replace(std::string s, std::string toReplace, std::string replace)
std::string StringHelpers::replace(std::string s, const std::string& toReplace, const std::string& replace)
{
if (s.empty() || toReplace.empty())
{
Expand Down
8 changes: 5 additions & 3 deletions src/localization/gettext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ namespace Nickvision::Aura
{
bool Localization::init()
{
bool res{ true };
std::string name{ StringHelpers::toLower(StringHelpers::replace(Aura::getActive().getAppInfo().getEnglishShortName(), " ", "")) };
if (name.empty())
{
name = StringHelpers::toLower(StringHelpers::replace(Aura::getActive().getAppInfo().getName(), " ", ""));
}
bindtextdomain(name.c_str(), std::filesystem::current_path().string().c_str());
bind_textdomain_codeset(name.c_str(), "UTF-8");
textdomain(name.c_str());
res &= bindtextdomain(name.c_str(), std::filesystem::current_path().string().c_str()) != nullptr;
res &= bind_textdomain_codeset(name.c_str(), "UTF-8") != nullptr;
res &= textdomain(name.c_str()) != nullptr;
return res;
}
}

0 comments on commit 484b12a

Please sign in to comment.