arg_router
1.4.0
C++ command line argument parsing and routing
iso_locale.hpp
1
// Copyright (C) 2022 by Camden Mannett.
2
// Distributed under the Boost Software License, Version 1.0.
3
// (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5
#pragma once
6
7
#include "arg_router/basic_types.hpp"
8
9
namespace
arg_router::multi_lang
10
{
35
inline
string
iso_locale
(std::string_view locale_name)
36
{
37
// No need to worry about UTF-8 here as the codes are required to be ASCII
38
// Start by stripping off the encoding
39
auto
result =
string
{};
40
{
41
const
auto
pos = locale_name.find(
'.'
);
42
result = locale_name.substr(0, pos);
43
}
44
45
// Change hypens to underscores
46
for
(
auto
& c : result) {
47
if
(c ==
'-'
) {
48
c =
'_'
;
49
}
50
}
51
52
return
result;
53
}
54
}
// namespace arg_router::multi_lang
arg_router::multi_lang
Definition:
iso_locale.hpp:10
arg_router::multi_lang::iso_locale
string iso_locale(std::string_view locale_name)
Definition:
iso_locale.hpp:35
arg_router
multi_lang
iso_locale.hpp
Generated by
1.9.1