neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
i18n.hpp
Go to the documentation of this file.
1// i18n.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
23
24namespace neogfx
25{
26 using neolib::i_string;
27 using neolib::string;
28
30 {
31 public:
32 translation_context(string const& aContext);
34 public:
35 static string const& context();
36 private:
37 static std::vector<string>& context_stack();
38 };
39
41 {
42 public:
43 translatable_string(i_string const& aTranslatableString, i_string const& aContext);
44 public:
46 translatable_string& operator()(std::int64_t aPlurality);
47 private:
48 string iTranslatableString;
49 string iContext;
50 };
51
52 translatable_string translate(string const& aTranslatableString);
53 translatable_string translate(string const& aTranslatableString, string const& aContext);
54 translatable_string operator "" _t(const char* aTranslatableString, std::size_t aStringLength);
55 translatable_string operator "" _t(const char8_t* aTranslatableString, std::size_t aStringLength);
56}
57
58using neogfx::operator "" _t;
translatable_string(i_string const &aTranslatableString, i_string const &aContext)
translatable_string & operator()(std::int64_t aPlurality)
static string const & context()
translation_context(string const &aContext)
translatable_string translate(string const &aTranslatableString)