annotate src/gui/translate/anime.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 5980a960f3e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
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
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
3 #include "gui/translate/anime.h"
202
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 187
diff changeset
4
51
75c804f713b2 window: add about window,
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
5 #include <QCoreApplication>
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
6
202
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 187
diff changeset
7 #include <unordered_map>
71832ffe425a animia: re-add kvm fd source
Paper <paper@paper.us.eu.org>
parents: 187
diff changeset
8
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
9 namespace Translate {
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
10
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
11 std::string ToString(const Anime::ListStatus status) {
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
12 switch (status) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
13 case Anime::ListStatus::Current: return "Currently watching";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
14 case Anime::ListStatus::Planning: return "Plan to watch";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
15 case Anime::ListStatus::Completed: return "Completed";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
16 case Anime::ListStatus::Dropped: return "Dropped";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
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
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
19 case Anime::ListStatus::NotInList: return "Not in list";
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
20 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
21 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
22
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
23 std::string ToString(const Anime::SeriesFormat format) {
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
24 switch (format) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
25 case Anime::SeriesFormat::Tv: return "TV";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
26 case Anime::SeriesFormat::TvShort: return "TV short";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
27 case Anime::SeriesFormat::Ova: return "OVA";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
28 case Anime::SeriesFormat::Movie: return "Movie";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
29 case Anime::SeriesFormat::Special: return "Special";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
30 case Anime::SeriesFormat::Ona: return "ONA";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
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
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
33 case Anime::SeriesFormat::Unknown: return "Unknown";
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
34 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
35 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
36
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
37 std::string ToString(const Anime::Season::Name season) {
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
38 switch (season) {
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
39 case Anime::Season::Name::Winter: return "Winter";
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
40 case Anime::Season::Name::Summer: return "Summer";
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
41 case Anime::Season::Name::Autumn: return "Autumn";
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
42 case Anime::Season::Name::Spring: return "Spring";
90
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
43 default:
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
44 case Anime::Season::Name::Unknown: return "Unknown";
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
45 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
46 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
47
15
cde8f67a7c7d *: update, megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 10
diff changeset
48 std::string ToString(const Anime::SeriesStatus status) {
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
49 switch (status) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
50 case Anime::SeriesStatus::Releasing: return "Currently airing";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
51 case Anime::SeriesStatus::Finished: return "Finished airing";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
52 case Anime::SeriesStatus::NotYetReleased: return "Not yet aired";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
53 case Anime::SeriesStatus::Cancelled: return "Cancelled";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
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
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
56 case Anime::SeriesStatus::Unknown: return "Unknown";
175
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
57 }
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
58 }
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
59
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
60 std::string ToString(const Anime::Service service) {
175
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
61 switch (service) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
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
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
65 default:
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
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
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
70 std::string ToString(const Anime::TitleLanguage language) {
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
71 switch (language) {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
72 case Anime::TitleLanguage::Native: return "Native";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
73 case Anime::TitleLanguage::English: return "English";
175
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
74 default:
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
75 case Anime::TitleLanguage::Romaji: return "Romaji";
175
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
76 }
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
77 }
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
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
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
81 case Anime::ScoreFormat::Point3: return "3-point";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
82 case Anime::ScoreFormat::Point5: return "5-point";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
83 case Anime::ScoreFormat::Point10: return "10-point";
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
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
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
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
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
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 = {
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
92 {"currently watching", Anime::ListStatus::Current },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
93 {"plan to watch", Anime::ListStatus::Planning },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
94 {"completed", Anime::ListStatus::Completed},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
95 {"dropped", Anime::ListStatus::Dropped },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
96 {"on hold", Anime::ListStatus::Paused }
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
97 };
174
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
98
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
99 std::string lower = Strings::ToLower(str);
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
100
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
101 if (map.find(lower) == map.end())
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
102 return Anime::ListStatus::NotInList;
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
103 return map.at(lower);
174
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
104 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
105
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
106 Anime::SeriesStatus ToSeriesStatus(const std::string& str) {
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
107 static const std::unordered_map<std::string, Anime::SeriesStatus> map = {
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
108 {"currently airing", Anime::SeriesStatus::Releasing },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
109 {"finished airing", Anime::SeriesStatus::Finished },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
110 {"not yet aired", Anime::SeriesStatus::NotYetReleased},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
111 {"cancelled", Anime::SeriesStatus::Cancelled },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
112 {"on hiatus", Anime::SeriesStatus::Hiatus }
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
113 };
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
114
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
115 std::string lower = Strings::ToLower(str);
174
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 if (map.find(str) == map.end())
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
118 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
119 return map.at(str);
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
120 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
121
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
122 Anime::Season::Name ToSeriesSeason(const std::string& str) {
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
123 static const std::unordered_map<std::string, Anime::Season::Name> map = {
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
124 {"winter", Anime::Season::Name::Winter},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
125 {"summer", Anime::Season::Name::Summer},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
126 {"fall", Anime::Season::Name::Autumn},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
127 {"autumn", Anime::Season::Name::Autumn},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
128 {"spring", Anime::Season::Name::Spring},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
129 };
174
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
130
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
131 std::string lower = Strings::ToLower(str);
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
132
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
133 if (map.find(lower) == map.end())
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
134 return Anime::Season::Name::Unknown;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
135 return map.at(lower);
10
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
136 }
Paper <mrpapersonic@gmail.com>
parents: 9
diff changeset
137
175
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
138 Anime::SeriesFormat ToSeriesFormat(const std::string& str) {
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
139 static const std::unordered_map<std::string, Anime::SeriesFormat> map = {
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
140 {"tv", Anime::SeriesFormat::Tv },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
141 {"tv short", Anime::SeriesFormat::TvShort},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
142 {"ova", Anime::SeriesFormat::Ova },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
143 {"movie", Anime::SeriesFormat::Movie },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
144 {"special", Anime::SeriesFormat::Special },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
145 {"ona", Anime::SeriesFormat::Ona },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
146 {"music", Anime::SeriesFormat::Music }
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
147 };
175
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
148
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
149 std::string lower = Strings::ToLower(str);
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
150
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
151 if (map.find(lower) == map.end())
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
152 return Anime::SeriesFormat::Unknown;
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
153 return map.at(lower);
175
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
154 }
9b10175be389 dep/json: update to v3.11.3
Paper <mrpapersonic@gmail.com>
parents: 174
diff changeset
155
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
156 Anime::Service ToService(const std::string& str) {
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
157 static const std::unordered_map<std::string, Anime::Service> map = {
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
158 {"anilist", Anime::Service::AniList},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
159 {"myanimelist", Anime::Service::MyAnimeList},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
160 {"kitsu", Anime::Service::Kitsu}
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
161 };
90
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
162
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
163 std::string lower = Strings::ToLower(str);
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
164
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
165 if (map.find(lower) == map.end())
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
166 return Anime::Service::None;
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
167 return map.at(lower);
90
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
168 }
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 Anime::TitleLanguage ToLanguage(const std::string& str) {
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
171 static const std::unordered_map<std::string, Anime::TitleLanguage> map = {
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
172 {"romaji", Anime::TitleLanguage::Romaji },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
173 {"native", Anime::TitleLanguage::Native },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
174 {"english", Anime::TitleLanguage::English}
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
175 };
90
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
176
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
177 std::string lower = Strings::ToLower(str);
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
178
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
179 if (map.find(lower) == map.end())
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
180 return Anime::TitleLanguage::Romaji;
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
181 return map.at(lower);
90
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
182 }
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
183
185
62e336597bb7 anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents: 175
diff changeset
184 Anime::ScoreFormat ToScoreFormat(const std::string& str) {
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
185 static const std::unordered_map<std::string, Anime::ScoreFormat> map = {
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
186 {"3-point", Anime::ScoreFormat::Point3},
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
187 {"5-point", Anime::ScoreFormat::Point5},
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
188 {"10-point", Anime::ScoreFormat::Point10 },
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
189 {"10-point decimal", Anime::ScoreFormat::Point10Decimal},
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
190 {"100-point", Anime::ScoreFormat::Point100 },
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
191 /* old values, provided for compatibility */
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
192 {"point_3", Anime::ScoreFormat::Point3 },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
193 {"point_5", Anime::ScoreFormat::Point5 },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
194 {"point_10", Anime::ScoreFormat::Point10 },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
195 {"point_10_decimal", Anime::ScoreFormat::Point10Decimal},
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
196 {"point_100", Anime::ScoreFormat::Point100 },
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
197 };
185
62e336597bb7 anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents: 175
diff changeset
198
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
199 std::string lower = Strings::ToLower(str);
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
200
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
201 if (map.find(lower) == map.end())
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
202 return Anime::ScoreFormat::Point100;
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
203 return map.at(lower);
185
62e336597bb7 anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents: 175
diff changeset
204 }
62e336597bb7 anime list: add support for different score formats
Paper <mrpapersonic@gmail.com>
parents: 175
diff changeset
205
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
206 /* 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
207
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
208 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
209 switch (status) {
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
210 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
211 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
212 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
213 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
214 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
215 default:
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
216 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
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
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
220 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
221 switch (format) {
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
222 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
223 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
224 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
225 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
226 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
227 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
228 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
229 default:
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
230 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
231 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
232 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
233
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
234 std::string ToLocalString(const Anime::Season::Name season) {
174
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
235 switch (season) {
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
236 case Anime::Season::Name::Winter: return Strings::Translate("Winter");
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
237 case Anime::Season::Name::Summer: return Strings::Translate("Summer");
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
238 case Anime::Season::Name::Autumn: return Strings::Translate("Autumn");
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
239 case Anime::Season::Name::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
240 default:
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
241 case Anime::Season::Name::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
242 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
243 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
244
327
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
245 std::string ToLocalString(const Anime::Season& season) {
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
246 std::string year = (season.year) ? Strings::ToUtf8String(season.year) : Strings::Translate("Unknown");
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
247
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
248 return ToLocalString(season.season) + " " + year;
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
249 }
b5d6c27c308f anime: refactor Anime::SeriesSeason to Season class
Paper <paper@paper.us.eu.org>
parents: 322
diff changeset
250
174
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
251 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
252 switch (status) {
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
253 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
254 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
255 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
256 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
257 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
258 default:
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
259 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
260 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
261 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
262
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
263 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
264 switch (service) {
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
265 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
266 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
267 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
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::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
270 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
271 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
272
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
273 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
274 switch (language) {
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
275 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
276 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
277 default:
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
278 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
279 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
280 }
f88eda79c60a anime/db: add some more json functionality, still doesn't compile :/
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
281
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
282 std::string ToLocalString(const Anime::ScoreFormat format) {
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
283 switch (format) {
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
284 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
285 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
286 case Anime::ScoreFormat::Point10: return Strings::Translate("10-point");
279
657fda1b9cac *: clean up enums
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
287 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
288 return Strings::Translate("10-point Decimal");
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
289 default:
322
c32467cd06bb core/strings: add Strings::Translate function as tr() -> ToUtf8String
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
290 case Anime::ScoreFormat::Point100: return Strings::Translate("100-point");
187
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
291 }
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
292 }
9613d72b097e *: multiple performance improvements
Paper <mrpapersonic@gmail.com>
parents: 185
diff changeset
293
46
d0adc4aedfc8 *: update...
Paper <mrpapersonic@gmail.com>
parents: 15
diff changeset
294 } // namespace Translate