comparison src/gui/translate/anime.cc @ 333:5980a960f3e1

translate/anime: use fmt for translating anime seasons
author Paper <paper@paper.us.eu.org>
date Mon, 17 Jun 2024 20:03:58 -0400
parents b5d6c27c308f
children
comparison
equal deleted inserted replaced
332:92f63cf29faa 333:5980a960f3e1
3 #include "gui/translate/anime.h" 3 #include "gui/translate/anime.h"
4 4
5 #include <QCoreApplication> 5 #include <QCoreApplication>
6 6
7 #include <unordered_map> 7 #include <unordered_map>
8
9 #include <fmt/core.h>
8 10
9 namespace Translate { 11 namespace Translate {
10 12
11 std::string ToString(const Anime::ListStatus status) { 13 std::string ToString(const Anime::ListStatus status) {
12 switch (status) { 14 switch (status) {
229 default: 231 default:
230 case Anime::SeriesFormat::Unknown: return Strings::Translate("Unknown"); 232 case Anime::SeriesFormat::Unknown: return Strings::Translate("Unknown");
231 } 233 }
232 } 234 }
233 235
234 std::string ToLocalString(const Anime::Season::Name season) { 236 static std::string ToLocalString(const Anime::Season::Name season) {
235 switch (season) { 237 switch (season) {
236 case Anime::Season::Name::Winter: return Strings::Translate("Winter"); 238 case Anime::Season::Name::Winter: return Strings::Translate("Winter");
237 case Anime::Season::Name::Summer: return Strings::Translate("Summer"); 239 case Anime::Season::Name::Summer: return Strings::Translate("Summer");
238 case Anime::Season::Name::Autumn: return Strings::Translate("Autumn"); 240 case Anime::Season::Name::Autumn: return Strings::Translate("Autumn");
239 case Anime::Season::Name::Spring: return Strings::Translate("Spring"); 241 case Anime::Season::Name::Spring: return Strings::Translate("Spring");
243 } 245 }
244 246
245 std::string ToLocalString(const Anime::Season& season) { 247 std::string ToLocalString(const Anime::Season& season) {
246 std::string year = (season.year) ? Strings::ToUtf8String(season.year) : Strings::Translate("Unknown"); 248 std::string year = (season.year) ? Strings::ToUtf8String(season.year) : Strings::Translate("Unknown");
247 249
248 return ToLocalString(season.season) + " " + year; 250 return fmt::format(Strings::Translate("{} {}"), ToLocalString(season.season), year);
249 } 251 }
250 252
251 std::string ToLocalString(const Anime::SeriesStatus status) { 253 std::string ToLocalString(const Anime::SeriesStatus status) {
252 switch (status) { 254 switch (status) {
253 case Anime::SeriesStatus::Releasing: return Strings::Translate("Currently airing"); 255 case Anime::SeriesStatus::Releasing: return Strings::Translate("Currently airing");