Mercurial > minori
annotate src/gui/translate/anime.cc @ 323:1686fac290c5
services/anilist: refactor HTTP requests...
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Wed, 12 Jun 2024 22:48:16 -0400 |
| parents | c32467cd06bb |
| children | b5d6c27c308f |
| rev | line source |
|---|---|
| 10 | 1 #include "core/anime.h" |
|
65
26721c28bf22
*: avoid usage of (to|from)StdString
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
2 #include "core/strings.h" |
| 15 | 3 #include "gui/translate/anime.h" |
| 202 | 4 |
| 51 | 5 #include <QCoreApplication> |
| 10 | 6 |
| 202 | 7 #include <unordered_map> |
| 8 | |
| 10 | 9 namespace Translate { |
| 10 | |
| 15 | 11 std::string ToString(const Anime::ListStatus status) { |
| 10 | 12 switch (status) { |
| 279 | 13 case Anime::ListStatus::Current: return "Currently watching"; |
| 14 case Anime::ListStatus::Planning: return "Plan to watch"; | |
| 15 case Anime::ListStatus::Completed: return "Completed"; | |
| 16 case Anime::ListStatus::Dropped: return "Dropped"; | |
| 17 case Anime::ListStatus::Paused: return "On hold"; | |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
18 default: |
| 279 | 19 case Anime::ListStatus::NotInList: return "Not in list"; |
| 10 | 20 } |
| 21 } | |
| 22 | |
| 15 | 23 std::string ToString(const Anime::SeriesFormat format) { |
| 10 | 24 switch (format) { |
| 279 | 25 case Anime::SeriesFormat::Tv: return "TV"; |
| 26 case Anime::SeriesFormat::TvShort: return "TV short"; | |
| 27 case Anime::SeriesFormat::Ova: return "OVA"; | |
| 28 case Anime::SeriesFormat::Movie: return "Movie"; | |
| 29 case Anime::SeriesFormat::Special: return "Special"; | |
| 30 case Anime::SeriesFormat::Ona: return "ONA"; | |
| 31 case Anime::SeriesFormat::Music: return "Music"; | |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
32 default: |
| 279 | 33 case Anime::SeriesFormat::Unknown: return "Unknown"; |
| 10 | 34 } |
| 35 } | |
| 36 | |
| 15 | 37 std::string ToString(const Anime::SeriesSeason season) { |
| 10 | 38 switch (season) { |
| 279 | 39 case Anime::SeriesSeason::Winter: return "Winter"; |
| 40 case Anime::SeriesSeason::Summer: return "Summer"; | |
| 41 case Anime::SeriesSeason::Fall: return "Fall"; | |
| 42 case Anime::SeriesSeason::Spring: return "Spring"; | |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
43 default: |
| 279 | 44 case Anime::SeriesSeason::Unknown: return "Unknown"; |
| 10 | 45 } |
| 46 } | |
| 47 | |
| 15 | 48 std::string ToString(const Anime::SeriesStatus status) { |
| 10 | 49 switch (status) { |
| 279 | 50 case Anime::SeriesStatus::Releasing: return "Currently airing"; |
| 51 case Anime::SeriesStatus::Finished: return "Finished airing"; | |
| 52 case Anime::SeriesStatus::NotYetReleased: return "Not yet aired"; | |
| 53 case Anime::SeriesStatus::Cancelled: return "Cancelled"; | |
| 54 case Anime::SeriesStatus::Hiatus: return "On hiatus"; | |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
55 default: |
| 279 | 56 case Anime::SeriesStatus::Unknown: return "Unknown"; |
| 175 | 57 } |
| 58 } | |
| 59 | |
| 279 | 60 std::string ToString(const Anime::Service service) { |
| 175 | 61 switch (service) { |
| 279 | 62 case Anime::Service::AniList: return "AniList"; |
|
286
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
63 case Anime::Service::MyAnimeList: return "MyAnimeList"; |
|
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
64 case Anime::Service::Kitsu: return "Kitsu"; |
| 175 | 65 default: |
| 279 | 66 case Anime::Service::None: return "None"; |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
67 } |
|
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
68 } |
|
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
69 |
| 175 | 70 std::string ToString(const Anime::TitleLanguage language) { |
| 71 switch (language) { | |
| 279 | 72 case Anime::TitleLanguage::Native: return "Native"; |
| 73 case Anime::TitleLanguage::English: return "English"; | |
| 175 | 74 default: |
| 279 | 75 case Anime::TitleLanguage::Romaji: return "Romaji"; |
| 175 | 76 } |
| 77 } | |
| 78 | |
|
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
79 std::string ToString(const Anime::ScoreFormat format) { |
|
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
80 switch (format) { |
| 279 | 81 case Anime::ScoreFormat::Point3: return "3-point"; |
| 82 case Anime::ScoreFormat::Point5: return "5-point"; | |
| 83 case Anime::ScoreFormat::Point10: return "10-point"; | |
| 84 case Anime::ScoreFormat::Point10Decimal: return "10-point Decimal"; | |
|
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
85 default: |
| 279 | 86 case Anime::ScoreFormat::Point100: return "100-point"; |
|
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
87 } |
|
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
88 } |
|
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
89 |
| 175 | 90 Anime::ListStatus ToListStatus(const std::string& str) { |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
91 static const std::unordered_map<std::string, Anime::ListStatus> map = { |
| 279 | 92 {"Currently watching", Anime::ListStatus::Current }, |
| 93 {"Plan to watch", Anime::ListStatus::Planning }, | |
| 94 {"Completed", Anime::ListStatus::Completed}, | |
| 95 {"Dropped", Anime::ListStatus::Dropped }, | |
| 96 {"On hold", Anime::ListStatus::Paused } | |
| 258 | 97 }; |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
98 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
99 if (map.find(str) == map.end()) |
| 279 | 100 return Anime::ListStatus::NotInList; |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
101 return map.at(str); |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
102 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
103 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
104 Anime::SeriesStatus ToSeriesStatus(const std::string& str) { |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
105 static const std::unordered_map<std::string, Anime::SeriesStatus> map = { |
| 279 | 106 {"Currently airing", Anime::SeriesStatus::Releasing }, |
| 107 {"Finished airing", Anime::SeriesStatus::Finished }, | |
| 108 {"Not yet aired", Anime::SeriesStatus::NotYetReleased}, | |
| 109 {"Cancelled", Anime::SeriesStatus::Cancelled }, | |
| 110 {"On hiatus", Anime::SeriesStatus::Hiatus } | |
| 258 | 111 }; |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
112 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
113 if (map.find(str) == map.end()) |
| 279 | 114 return Anime::SeriesStatus::Unknown; |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
115 return map.at(str); |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
116 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
117 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
118 Anime::SeriesSeason ToSeriesSeason(const std::string& str) { |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
119 static const std::unordered_map<std::string, Anime::SeriesSeason> map = { |
| 279 | 120 {"Winter", Anime::SeriesSeason::Winter}, |
| 121 {"Summer", Anime::SeriesSeason::Summer}, | |
| 122 {"Fall", Anime::SeriesSeason::Fall }, | |
| 123 {"Spring", Anime::SeriesSeason::Spring} | |
| 258 | 124 }; |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
125 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
126 if (map.find(str) == map.end()) |
| 279 | 127 return Anime::SeriesSeason::Unknown; |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
128 return map.at(str); |
| 10 | 129 } |
| 130 | |
| 175 | 131 Anime::SeriesFormat ToSeriesFormat(const std::string& str) { |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
132 static const std::unordered_map<std::string, Anime::SeriesFormat> map = { |
| 279 | 133 {"TV", Anime::SeriesFormat::Tv }, |
| 134 {"TV short", Anime::SeriesFormat::TvShort}, | |
| 135 {"OVA", Anime::SeriesFormat::Ova }, | |
| 136 {"Movie", Anime::SeriesFormat::Movie }, | |
| 137 {"Special", Anime::SeriesFormat::Special }, | |
| 138 {"ONA", Anime::SeriesFormat::Ona }, | |
| 139 {"Music", Anime::SeriesFormat::Music } | |
| 258 | 140 }; |
| 175 | 141 |
| 142 if (map.find(str) == map.end()) | |
| 279 | 143 return Anime::SeriesFormat::Unknown; |
| 175 | 144 return map.at(str); |
| 145 } | |
| 146 | |
| 279 | 147 Anime::Service ToService(const std::string& str) { |
| 148 static const std::unordered_map<std::string, Anime::Service> map = { | |
|
286
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
149 {"AniList", Anime::Service::AniList}, |
|
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
150 {"MyAnimeList", Anime::Service::MyAnimeList}, |
|
53e3c015a973
anime: initial cross-service support
Paper <paper@paper.us.eu.org>
parents:
279
diff
changeset
|
151 {"Kitsu", Anime::Service::Kitsu} |
| 258 | 152 }; |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
153 |
|
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
154 if (map.find(str) == map.end()) |
| 279 | 155 return Anime::Service::None; |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
156 return map.at(str); |
|
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
157 } |
|
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
158 |
|
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
159 Anime::TitleLanguage ToLanguage(const std::string& str) { |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
160 static const std::unordered_map<std::string, Anime::TitleLanguage> map = { |
| 279 | 161 {"Romaji", Anime::TitleLanguage::Romaji }, |
| 162 {"Native", Anime::TitleLanguage::Native }, | |
| 163 {"English", Anime::TitleLanguage::English} | |
| 258 | 164 }; |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
165 |
|
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
166 if (map.find(str) == map.end()) |
| 279 | 167 return Anime::TitleLanguage::Romaji; |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
168 return map.at(str); |
|
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
169 } |
|
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
170 |
|
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
171 Anime::ScoreFormat ToScoreFormat(const std::string& str) { |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
172 static const std::unordered_map<std::string, Anime::ScoreFormat> map = { |
| 279 | 173 {"3-point", Anime::ScoreFormat::Point3}, |
| 174 {"5-point", Anime::ScoreFormat::Point5}, | |
| 175 {"10-point", Anime::ScoreFormat::Point10 }, | |
| 176 {"10-point Decimal", Anime::ScoreFormat::Point10Decimal}, | |
| 177 {"100-point", Anime::ScoreFormat::Point100 }, | |
| 178 /* old values, provided for compatibility */ | |
| 179 {"POINT_3", Anime::ScoreFormat::Point3 }, | |
| 180 {"POINT_5", Anime::ScoreFormat::Point5 }, | |
| 181 {"POINT_10", Anime::ScoreFormat::Point10 }, | |
| 182 {"POINT_10_DECIMAL", Anime::ScoreFormat::Point10Decimal}, | |
| 183 {"POINT_100", Anime::ScoreFormat::Point100 } | |
| 258 | 184 }; |
|
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
185 |
|
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
186 if (map.find(str) == map.end()) |
| 279 | 187 return Anime::ScoreFormat::Point100; |
|
185
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
188 return map.at(str); |
|
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
189 } |
|
62e336597bb7
anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents:
175
diff
changeset
|
190 |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
191 /* Localized versions of ToString() functions. Meant for display to the user. */ |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
192 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
193 std::string ToLocalString(const Anime::ListStatus status) { |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
194 switch (status) { |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
195 case Anime::ListStatus::Current: return Strings::Translate("Currently watching"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
196 case Anime::ListStatus::Planning: return Strings::Translate("Plan to watch"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
197 case Anime::ListStatus::Completed: return Strings::Translate("Completed"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
198 case Anime::ListStatus::Dropped: return Strings::Translate("Dropped"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
199 case Anime::ListStatus::Paused: return Strings::Translate("On hold"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
200 default: |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
201 case Anime::ListStatus::NotInList: return Strings::Translate("Not in list"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
202 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
203 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
204 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
205 std::string ToLocalString(const Anime::SeriesFormat format) { |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
206 switch (format) { |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
207 case Anime::SeriesFormat::Tv: return Strings::Translate("TV"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
208 case Anime::SeriesFormat::TvShort: return Strings::Translate("TV short"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
209 case Anime::SeriesFormat::Ova: return Strings::Translate("OVA"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
210 case Anime::SeriesFormat::Movie: return Strings::Translate("Movie"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
211 case Anime::SeriesFormat::Special: return Strings::Translate("Special"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
212 case Anime::SeriesFormat::Ona: return Strings::Translate("ONA"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
213 case Anime::SeriesFormat::Music: return Strings::Translate("Music"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
214 default: |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
215 case Anime::SeriesFormat::Unknown: return Strings::Translate("Unknown"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
216 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
217 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
218 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
219 std::string ToLocalString(const Anime::SeriesSeason season) { |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
220 switch (season) { |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
221 case Anime::SeriesSeason::Winter: return Strings::Translate("Winter"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
222 case Anime::SeriesSeason::Summer: return Strings::Translate("Summer"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
223 case Anime::SeriesSeason::Fall: return Strings::Translate("Fall"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
224 case Anime::SeriesSeason::Spring: return Strings::Translate("Spring"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
225 default: |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
226 case Anime::SeriesSeason::Unknown: return Strings::Translate("Unknown"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
227 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
228 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
229 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
230 std::string ToLocalString(const Anime::SeriesStatus status) { |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
231 switch (status) { |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
232 case Anime::SeriesStatus::Releasing: return Strings::Translate("Currently airing"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
233 case Anime::SeriesStatus::Finished: return Strings::Translate("Finished airing"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
234 case Anime::SeriesStatus::NotYetReleased: return Strings::Translate("Not yet aired"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
235 case Anime::SeriesStatus::Cancelled: return Strings::Translate("Cancelled"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
236 case Anime::SeriesStatus::Hiatus: return Strings::Translate("On hiatus"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
237 default: |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
238 case Anime::SeriesStatus::Unknown: return Strings::Translate("Unknown"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
239 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
240 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
241 |
| 279 | 242 std::string ToLocalString(const Anime::Service service) { |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
243 switch (service) { |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
244 case Anime::Service::AniList: return Strings::Translate("AniList"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
245 case Anime::Service::MyAnimeList: return Strings::Translate("MyAnimeList"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
246 case Anime::Service::Kitsu: return Strings::Translate("Kitsu"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
247 default: |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
248 case Anime::Service::None: return Strings::Translate("None"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
249 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
250 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
251 |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
252 std::string ToLocalString(const Anime::TitleLanguage language) { |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
253 switch (language) { |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
254 case Anime::TitleLanguage::Native: return Strings::Translate("Native"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
255 case Anime::TitleLanguage::English: return Strings::Translate("English"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
256 default: |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
257 case Anime::TitleLanguage::Romaji: return Strings::Translate("Romaji"); |
|
174
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
258 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
259 } |
|
f88eda79c60a
anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents:
90
diff
changeset
|
260 |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
261 std::string ToLocalString(const Anime::ScoreFormat format) { |
|
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
262 switch (format) { |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
263 case Anime::ScoreFormat::Point3: return Strings::Translate("3-point"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
264 case Anime::ScoreFormat::Point5: return Strings::Translate("5-point"); |
|
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
265 case Anime::ScoreFormat::Point10: return Strings::Translate("10-point"); |
| 279 | 266 case Anime::ScoreFormat::Point10Decimal: |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
267 return Strings::Translate("10-point Decimal"); |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
268 default: |
|
322
c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents:
286
diff
changeset
|
269 case Anime::ScoreFormat::Point100: return Strings::Translate("100-point"); |
|
187
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
270 } |
|
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
271 } |
|
9613d72b097e
*: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents:
185
diff
changeset
|
272 |
| 46 | 273 } // namespace Translate |
