Mercurial > minori
annotate src/gui/translate/config.cc @ 327:b5d6c27c308f
anime: refactor Anime::SeriesSeason to Season class
ToLocalString has also been altered to take in both season
and year because lots of locales actually treat formatting
seasons differently! most notably is Russian which adds a
suffix at the end to notate seasons(??)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Thu, 13 Jun 2024 01:49:18 -0400 |
parents | c32467cd06bb |
children |
rev | line source |
---|---|
301
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
1 #include "core/config.h" |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
2 #include "core/strings.h" |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
3 #include "gui/translate/config.h" |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
4 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
5 #include <QCoreApplication> |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
6 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
7 #include <unordered_map> |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
8 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
9 namespace Translate { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
10 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
11 Theme::Theme ToTheme(const std::string& theme) { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
12 const std::unordered_map<std::string, Theme::Theme> map = { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
13 {"Default", Theme::Theme::Default }, |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
14 {"Light", Theme::Theme::Light}, |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
15 {"Dark", Theme::Theme::Dark } |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
16 }; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
17 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
18 if (map.find(theme) == map.end()) |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
19 return Theme::Theme::Default; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
20 return map.at(theme); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
21 } |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
22 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
23 std::string ToString(const Theme::Theme& theme) { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
24 switch (theme) { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
25 default: |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
26 case Theme::Theme::Default: return "Default"; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
27 case Theme::Theme::Light: return "Light"; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
28 case Theme::Theme::Dark: return "Dark"; |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
29 } |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
30 } |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
31 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
32 std::string ToLocalString(const Theme::Theme& theme) { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
33 switch (theme) { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
34 default: |
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
301
diff
changeset
|
35 case Theme::Theme::Default: return Strings::Translate("Default"); |
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
301
diff
changeset
|
36 case Theme::Theme::Light: return Strings::Translate("Light"); |
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
301
diff
changeset
|
37 case Theme::Theme::Dark: return Strings::Translate("Dark"); |
301
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
38 } |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
39 } |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
40 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
41 } // namespace Translate |