Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
321:8141f409d52c | 322:c32467cd06bb |
---|---|
190 | 190 |
191 /* Localized versions of ToString() functions. Meant for display to the user. */ | 191 /* Localized versions of ToString() functions. Meant for display to the user. */ |
192 | 192 |
193 std::string ToLocalString(const Anime::ListStatus status) { | 193 std::string ToLocalString(const Anime::ListStatus status) { |
194 switch (status) { | 194 switch (status) { |
195 case Anime::ListStatus::Current: return Strings::ToUtf8String(QCoreApplication::tr("Currently watching")); | 195 case Anime::ListStatus::Current: return Strings::Translate("Currently watching"); |
196 case Anime::ListStatus::Planning: return Strings::ToUtf8String(QCoreApplication::tr("Plan to watch")); | 196 case Anime::ListStatus::Planning: return Strings::Translate("Plan to watch"); |
197 case Anime::ListStatus::Completed: return Strings::ToUtf8String(QCoreApplication::tr("Completed")); | 197 case Anime::ListStatus::Completed: return Strings::Translate("Completed"); |
198 case Anime::ListStatus::Dropped: return Strings::ToUtf8String(QCoreApplication::tr("Dropped")); | 198 case Anime::ListStatus::Dropped: return Strings::Translate("Dropped"); |
199 case Anime::ListStatus::Paused: return Strings::ToUtf8String(QCoreApplication::tr("On hold")); | 199 case Anime::ListStatus::Paused: return Strings::Translate("On hold"); |
200 default: | 200 default: |
201 case Anime::ListStatus::NotInList: return Strings::ToUtf8String(QCoreApplication::tr("Not in list")); | 201 case Anime::ListStatus::NotInList: return Strings::Translate("Not in list"); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 std::string ToLocalString(const Anime::SeriesFormat format) { | 205 std::string ToLocalString(const Anime::SeriesFormat format) { |
206 switch (format) { | 206 switch (format) { |
207 case Anime::SeriesFormat::Tv: return Strings::ToUtf8String(QCoreApplication::tr("TV")); | 207 case Anime::SeriesFormat::Tv: return Strings::Translate("TV"); |
208 case Anime::SeriesFormat::TvShort: return Strings::ToUtf8String(QCoreApplication::tr("TV short")); | 208 case Anime::SeriesFormat::TvShort: return Strings::Translate("TV short"); |
209 case Anime::SeriesFormat::Ova: return Strings::ToUtf8String(QCoreApplication::tr("OVA")); | 209 case Anime::SeriesFormat::Ova: return Strings::Translate("OVA"); |
210 case Anime::SeriesFormat::Movie: return Strings::ToUtf8String(QCoreApplication::tr("Movie")); | 210 case Anime::SeriesFormat::Movie: return Strings::Translate("Movie"); |
211 case Anime::SeriesFormat::Special: return Strings::ToUtf8String(QCoreApplication::tr("Special")); | 211 case Anime::SeriesFormat::Special: return Strings::Translate("Special"); |
212 case Anime::SeriesFormat::Ona: return Strings::ToUtf8String(QCoreApplication::tr("ONA")); | 212 case Anime::SeriesFormat::Ona: return Strings::Translate("ONA"); |
213 case Anime::SeriesFormat::Music: return Strings::ToUtf8String(QCoreApplication::tr("Music")); | 213 case Anime::SeriesFormat::Music: return Strings::Translate("Music"); |
214 default: | 214 default: |
215 case Anime::SeriesFormat::Unknown: return Strings::ToUtf8String(QCoreApplication::tr("Unknown")); | 215 case Anime::SeriesFormat::Unknown: return Strings::Translate("Unknown"); |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 std::string ToLocalString(const Anime::SeriesSeason season) { | 219 std::string ToLocalString(const Anime::SeriesSeason season) { |
220 switch (season) { | 220 switch (season) { |
221 case Anime::SeriesSeason::Winter: return Strings::ToUtf8String(QCoreApplication::tr("Winter")); | 221 case Anime::SeriesSeason::Winter: return Strings::Translate("Winter"); |
222 case Anime::SeriesSeason::Summer: return Strings::ToUtf8String(QCoreApplication::tr("Summer")); | 222 case Anime::SeriesSeason::Summer: return Strings::Translate("Summer"); |
223 case Anime::SeriesSeason::Fall: return Strings::ToUtf8String(QCoreApplication::tr("Fall")); | 223 case Anime::SeriesSeason::Fall: return Strings::Translate("Fall"); |
224 case Anime::SeriesSeason::Spring: return Strings::ToUtf8String(QCoreApplication::tr("Spring")); | 224 case Anime::SeriesSeason::Spring: return Strings::Translate("Spring"); |
225 default: | 225 default: |
226 case Anime::SeriesSeason::Unknown: return Strings::ToUtf8String(QCoreApplication::tr("Unknown")); | 226 case Anime::SeriesSeason::Unknown: return Strings::Translate("Unknown"); |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 std::string ToLocalString(const Anime::SeriesStatus status) { | 230 std::string ToLocalString(const Anime::SeriesStatus status) { |
231 switch (status) { | 231 switch (status) { |
232 case Anime::SeriesStatus::Releasing: return Strings::ToUtf8String(QCoreApplication::tr("Currently airing")); | 232 case Anime::SeriesStatus::Releasing: return Strings::Translate("Currently airing"); |
233 case Anime::SeriesStatus::Finished: return Strings::ToUtf8String(QCoreApplication::tr("Finished airing")); | 233 case Anime::SeriesStatus::Finished: return Strings::Translate("Finished airing"); |
234 case Anime::SeriesStatus::NotYetReleased: return Strings::ToUtf8String(QCoreApplication::tr("Not yet aired")); | 234 case Anime::SeriesStatus::NotYetReleased: return Strings::Translate("Not yet aired"); |
235 case Anime::SeriesStatus::Cancelled: return Strings::ToUtf8String(QCoreApplication::tr("Cancelled")); | 235 case Anime::SeriesStatus::Cancelled: return Strings::Translate("Cancelled"); |
236 case Anime::SeriesStatus::Hiatus: return Strings::ToUtf8String(QCoreApplication::tr("On hiatus")); | 236 case Anime::SeriesStatus::Hiatus: return Strings::Translate("On hiatus"); |
237 default: | 237 default: |
238 case Anime::SeriesStatus::Unknown: return Strings::ToUtf8String(QCoreApplication::tr("Unknown")); | 238 case Anime::SeriesStatus::Unknown: return Strings::Translate("Unknown"); |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 std::string ToLocalString(const Anime::Service service) { | 242 std::string ToLocalString(const Anime::Service service) { |
243 switch (service) { | 243 switch (service) { |
244 case Anime::Service::AniList: return Strings::ToUtf8String(QCoreApplication::tr("AniList")); | 244 case Anime::Service::AniList: return Strings::Translate("AniList"); |
245 case Anime::Service::MyAnimeList: return Strings::ToUtf8String(QCoreApplication::tr("MyAnimeList")); | 245 case Anime::Service::MyAnimeList: return Strings::Translate("MyAnimeList"); |
246 case Anime::Service::Kitsu: return Strings::ToUtf8String(QCoreApplication::tr("Kitsu")); | 246 case Anime::Service::Kitsu: return Strings::Translate("Kitsu"); |
247 default: | 247 default: |
248 case Anime::Service::None: return Strings::ToUtf8String(QCoreApplication::tr("None")); | 248 case Anime::Service::None: return Strings::Translate("None"); |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 std::string ToLocalString(const Anime::TitleLanguage language) { | 252 std::string ToLocalString(const Anime::TitleLanguage language) { |
253 switch (language) { | 253 switch (language) { |
254 case Anime::TitleLanguage::Native: return Strings::ToUtf8String(QCoreApplication::tr("Native")); | 254 case Anime::TitleLanguage::Native: return Strings::Translate("Native"); |
255 case Anime::TitleLanguage::English: return Strings::ToUtf8String(QCoreApplication::tr("English")); | 255 case Anime::TitleLanguage::English: return Strings::Translate("English"); |
256 default: | 256 default: |
257 case Anime::TitleLanguage::Romaji: return Strings::ToUtf8String(QCoreApplication::tr("Romaji")); | 257 case Anime::TitleLanguage::Romaji: return Strings::Translate("Romaji"); |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 std::string ToLocalString(const Anime::ScoreFormat format) { | 261 std::string ToLocalString(const Anime::ScoreFormat format) { |
262 switch (format) { | 262 switch (format) { |
263 case Anime::ScoreFormat::Point3: return Strings::ToUtf8String(QCoreApplication::tr("3-point")); | 263 case Anime::ScoreFormat::Point3: return Strings::Translate("3-point"); |
264 case Anime::ScoreFormat::Point5: return Strings::ToUtf8String(QCoreApplication::tr("5-point")); | 264 case Anime::ScoreFormat::Point5: return Strings::Translate("5-point"); |
265 case Anime::ScoreFormat::Point10: return Strings::ToUtf8String(QCoreApplication::tr("10-point")); | 265 case Anime::ScoreFormat::Point10: return Strings::Translate("10-point"); |
266 case Anime::ScoreFormat::Point10Decimal: | 266 case Anime::ScoreFormat::Point10Decimal: |
267 return Strings::ToUtf8String(QCoreApplication::tr("10-point Decimal")); | 267 return Strings::Translate("10-point Decimal"); |
268 default: | 268 default: |
269 case Anime::ScoreFormat::Point100: return Strings::ToUtf8String(QCoreApplication::tr("100-point")); | 269 case Anime::ScoreFormat::Point100: return Strings::Translate("100-point"); |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 } // namespace Translate | 273 } // namespace Translate |