Skip to content

Commit

Permalink
Update translator.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Dec 1, 2023
1 parent 2399573 commit 9a62afe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/xtd.core/src/xtd/translator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
#include "../../include/xtd/io/directory.h"
#include "../../include/xtd/io/file.h"
#include "../../include/xtd/io/path.h"
#include "../../include/xtd/threading/lock_guard.h"
#define __XTD_CORE_NATIVE_LIBRARY__
#include <xtd/native/translator>
#undef __XTD_CORE_NATIVE_LIBRARY__

using namespace std;
using namespace xtd;
using namespace xtd::io;
using namespace xtd::collections::specialized;
using namespace xtd::io;

map<ustring, string_map> translator::language_values_;
ustring translator::language_;
Expand Down Expand Up @@ -123,8 +124,8 @@ const char* translator::translate(const xtd::ustring& language, const char* valu
}

void translator::initialize() {
static auto mutex_init = recursive_mutex {};
auto lock = lock_guard<recursive_mutex> {mutex_init};
static object sync_root;
auto lock = threading::lock_guard {sync_root};

if (language_.empty()) {
if (!std::locale {}.name().empty() && std::locale {}.name() != "C") language_ = locale_to_language(std::locale {}.name());
Expand Down

0 comments on commit 9a62afe

Please sign in to comment.