GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
IMultipleTextLocalized.cpp
Go to the documentation of this file.
2
3using namespace std;
4
5namespace gui_framework
6{
7 namespace interfaces
8 {
10 ITextLocalized(autoUpdate)
11 {
12
13 }
14
15 void IMultipleTextLocalized::addLocalizationKey(string_view localizationKey)
16 {
17 if (ranges::find(localizationKeys, localizationKey) != localizationKeys.end())
18 {
19 return;
20 }
21
22 localizationKeys.emplace_back(localizationKey);
23 }
24
25 void IMultipleTextLocalized::insertLocalizationKey(size_t index, const string& localizationKey)
26 {
27 if (ranges::find(localizationKeys, localizationKey) != localizationKeys.end())
28 {
29 return;
30 }
31
32 localizationKeys.insert(localizationKeys.begin() + index, localizationKey);
33 }
34
35 void IMultipleTextLocalized::insertLocalizationKey(size_t index, string&& localizationKey) noexcept
36 {
37 if (ranges::find(localizationKeys, localizationKey) != localizationKeys.end())
38 {
39 return;
40 }
41
42 localizationKeys.insert(localizationKeys.begin() + index, move(localizationKey));
43 }
44
46 {
47 localizationKeys.erase(localizationKeys.begin() + index);
48 }
49
50 void IMultipleTextLocalized::removeLocalizationKey(string_view localizationKey)
51 {
52 erase(localizationKeys, localizationKey);
53 }
54
55 const vector<string>& IMultipleTextLocalized::getLocalizationKeys() const
56 {
57 return localizationKeys;
58 }
59
61 {
62 localization::WTextLocalization& textLocalization = localization::WTextLocalization::get();
63
64 for (size_t i = 0; i < localizationKeys.size(); i++)
65 {
66 this->updateLocalization(i, textLocalization[localizationKeys[i]]);
67 }
68
69 return localizationKeys.size();
70 }
71 }
72}
void insertLocalizationKey(size_t index, const std::string &localizationKey)
virtual void updateLocalization(size_t index, std::wstring_view localizedText)=0
void addLocalizationKey(std::string_view localizationKey)
const std::vector< std::string > & getLocalizationKeys() const
Provides changing localization in component by calling GUIFramework::changeLocalization.