Mercurial > minori
diff src/gui/translate/anime.cc @ 322:c32467cd06bb
core/strings: add Strings::Translate function as tr() -> ToUtf8String
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 12 Jun 2024 22:15:53 -0400 |
parents | 53e3c015a973 |
children | b5d6c27c308f |
line wrap: on
line diff
--- a/src/gui/translate/anime.cc Wed Jun 12 20:42:44 2024 -0400 +++ b/src/gui/translate/anime.cc Wed Jun 12 22:15:53 2024 -0400 @@ -192,81 +192,81 @@ std::string ToLocalString(const Anime::ListStatus status) { switch (status) { - case Anime::ListStatus::Current: return Strings::ToUtf8String(QCoreApplication::tr("Currently watching")); - case Anime::ListStatus::Planning: return Strings::ToUtf8String(QCoreApplication::tr("Plan to watch")); - case Anime::ListStatus::Completed: return Strings::ToUtf8String(QCoreApplication::tr("Completed")); - case Anime::ListStatus::Dropped: return Strings::ToUtf8String(QCoreApplication::tr("Dropped")); - case Anime::ListStatus::Paused: return Strings::ToUtf8String(QCoreApplication::tr("On hold")); + case Anime::ListStatus::Current: return Strings::Translate("Currently watching"); + case Anime::ListStatus::Planning: return Strings::Translate("Plan to watch"); + case Anime::ListStatus::Completed: return Strings::Translate("Completed"); + case Anime::ListStatus::Dropped: return Strings::Translate("Dropped"); + case Anime::ListStatus::Paused: return Strings::Translate("On hold"); default: - case Anime::ListStatus::NotInList: return Strings::ToUtf8String(QCoreApplication::tr("Not in list")); + case Anime::ListStatus::NotInList: return Strings::Translate("Not in list"); } } std::string ToLocalString(const Anime::SeriesFormat format) { switch (format) { - case Anime::SeriesFormat::Tv: return Strings::ToUtf8String(QCoreApplication::tr("TV")); - case Anime::SeriesFormat::TvShort: return Strings::ToUtf8String(QCoreApplication::tr("TV short")); - case Anime::SeriesFormat::Ova: return Strings::ToUtf8String(QCoreApplication::tr("OVA")); - case Anime::SeriesFormat::Movie: return Strings::ToUtf8String(QCoreApplication::tr("Movie")); - case Anime::SeriesFormat::Special: return Strings::ToUtf8String(QCoreApplication::tr("Special")); - case Anime::SeriesFormat::Ona: return Strings::ToUtf8String(QCoreApplication::tr("ONA")); - case Anime::SeriesFormat::Music: return Strings::ToUtf8String(QCoreApplication::tr("Music")); + case Anime::SeriesFormat::Tv: return Strings::Translate("TV"); + case Anime::SeriesFormat::TvShort: return Strings::Translate("TV short"); + case Anime::SeriesFormat::Ova: return Strings::Translate("OVA"); + case Anime::SeriesFormat::Movie: return Strings::Translate("Movie"); + case Anime::SeriesFormat::Special: return Strings::Translate("Special"); + case Anime::SeriesFormat::Ona: return Strings::Translate("ONA"); + case Anime::SeriesFormat::Music: return Strings::Translate("Music"); default: - case Anime::SeriesFormat::Unknown: return Strings::ToUtf8String(QCoreApplication::tr("Unknown")); + case Anime::SeriesFormat::Unknown: return Strings::Translate("Unknown"); } } std::string ToLocalString(const Anime::SeriesSeason season) { switch (season) { - case Anime::SeriesSeason::Winter: return Strings::ToUtf8String(QCoreApplication::tr("Winter")); - case Anime::SeriesSeason::Summer: return Strings::ToUtf8String(QCoreApplication::tr("Summer")); - case Anime::SeriesSeason::Fall: return Strings::ToUtf8String(QCoreApplication::tr("Fall")); - case Anime::SeriesSeason::Spring: return Strings::ToUtf8String(QCoreApplication::tr("Spring")); + case Anime::SeriesSeason::Winter: return Strings::Translate("Winter"); + case Anime::SeriesSeason::Summer: return Strings::Translate("Summer"); + case Anime::SeriesSeason::Fall: return Strings::Translate("Fall"); + case Anime::SeriesSeason::Spring: return Strings::Translate("Spring"); default: - case Anime::SeriesSeason::Unknown: return Strings::ToUtf8String(QCoreApplication::tr("Unknown")); + case Anime::SeriesSeason::Unknown: return Strings::Translate("Unknown"); } } std::string ToLocalString(const Anime::SeriesStatus status) { switch (status) { - case Anime::SeriesStatus::Releasing: return Strings::ToUtf8String(QCoreApplication::tr("Currently airing")); - case Anime::SeriesStatus::Finished: return Strings::ToUtf8String(QCoreApplication::tr("Finished airing")); - case Anime::SeriesStatus::NotYetReleased: return Strings::ToUtf8String(QCoreApplication::tr("Not yet aired")); - case Anime::SeriesStatus::Cancelled: return Strings::ToUtf8String(QCoreApplication::tr("Cancelled")); - case Anime::SeriesStatus::Hiatus: return Strings::ToUtf8String(QCoreApplication::tr("On hiatus")); + case Anime::SeriesStatus::Releasing: return Strings::Translate("Currently airing"); + case Anime::SeriesStatus::Finished: return Strings::Translate("Finished airing"); + case Anime::SeriesStatus::NotYetReleased: return Strings::Translate("Not yet aired"); + case Anime::SeriesStatus::Cancelled: return Strings::Translate("Cancelled"); + case Anime::SeriesStatus::Hiatus: return Strings::Translate("On hiatus"); default: - case Anime::SeriesStatus::Unknown: return Strings::ToUtf8String(QCoreApplication::tr("Unknown")); + case Anime::SeriesStatus::Unknown: return Strings::Translate("Unknown"); } } std::string ToLocalString(const Anime::Service service) { switch (service) { - case Anime::Service::AniList: return Strings::ToUtf8String(QCoreApplication::tr("AniList")); - case Anime::Service::MyAnimeList: return Strings::ToUtf8String(QCoreApplication::tr("MyAnimeList")); - case Anime::Service::Kitsu: return Strings::ToUtf8String(QCoreApplication::tr("Kitsu")); + case Anime::Service::AniList: return Strings::Translate("AniList"); + case Anime::Service::MyAnimeList: return Strings::Translate("MyAnimeList"); + case Anime::Service::Kitsu: return Strings::Translate("Kitsu"); default: - case Anime::Service::None: return Strings::ToUtf8String(QCoreApplication::tr("None")); + case Anime::Service::None: return Strings::Translate("None"); } } std::string ToLocalString(const Anime::TitleLanguage language) { switch (language) { - case Anime::TitleLanguage::Native: return Strings::ToUtf8String(QCoreApplication::tr("Native")); - case Anime::TitleLanguage::English: return Strings::ToUtf8String(QCoreApplication::tr("English")); + case Anime::TitleLanguage::Native: return Strings::Translate("Native"); + case Anime::TitleLanguage::English: return Strings::Translate("English"); default: - case Anime::TitleLanguage::Romaji: return Strings::ToUtf8String(QCoreApplication::tr("Romaji")); + case Anime::TitleLanguage::Romaji: return Strings::Translate("Romaji"); } } std::string ToLocalString(const Anime::ScoreFormat format) { switch (format) { - case Anime::ScoreFormat::Point3: return Strings::ToUtf8String(QCoreApplication::tr("3-point")); - case Anime::ScoreFormat::Point5: return Strings::ToUtf8String(QCoreApplication::tr("5-point")); - case Anime::ScoreFormat::Point10: return Strings::ToUtf8String(QCoreApplication::tr("10-point")); + case Anime::ScoreFormat::Point3: return Strings::Translate("3-point"); + case Anime::ScoreFormat::Point5: return Strings::Translate("5-point"); + case Anime::ScoreFormat::Point10: return Strings::Translate("10-point"); case Anime::ScoreFormat::Point10Decimal: - return Strings::ToUtf8String(QCoreApplication::tr("10-point Decimal")); + return Strings::Translate("10-point Decimal"); default: - case Anime::ScoreFormat::Point100: return Strings::ToUtf8String(QCoreApplication::tr("100-point")); + case Anime::ScoreFormat::Point100: return Strings::Translate("100-point"); } }