summaryrefslogtreecommitdiff
path: root/Source/Core/Common/LocaleUtil.cpp
blob: b6d923f709375b9029e46fa503820d5b5e971773 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2026 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include "Common/LocaleUtil.h"

#include <locale.h>

namespace Common
{
std::locale GetEnvironmentLocale()
{
#ifdef _WIN32
  if (_locale_t loc = _create_locale(LC_ALL, ""))
  {
    _free_locale(loc);
    return std::locale{""};
  }
#else
  if (locale_t loc = newlocale(LC_ALL_MASK, "", static_cast<locale_t>(0)))
  {
    freelocale(loc);
    return std::locale{""};
  }
#endif
  return std::locale::classic();
}
}  // Namespace Common