diff src/services/services.cc @ 334:948955c3ba81

services: use fmt for setting the status bar this should make localization easier
author Paper <paper@paper.us.eu.org>
date Mon, 17 Jun 2024 20:35:31 -0400
parents b5d6c27c308f
children
line wrap: on
line diff
--- a/src/services/services.cc	Mon Jun 17 20:03:58 2024 -0400
+++ b/src/services/services.cc	Mon Jun 17 20:35:31 2024 -0400
@@ -1,13 +1,16 @@
 #include "services/services.h"
 #include "core/session.h"
+#include "core/strings.h"
 #include "gui/translate/anime.h"
 #include "services/anilist.h"
 #include "services/kitsu.h"
 
+#include <fmt/core.h>
+
 namespace Services {
 
 void Synchronize() {
-	session.SetStatusBar(Translate::ToString(session.config.service) + ": Retrieving anime list...");
+	session.SetStatusBar(fmt::format(Strings::Translate("{}: Retrieving anime list..."), Translate::ToString(session.config.service)));
 
 	switch (session.config.service) {
 		case Anime::Service::AniList: AniList::GetAnimeList(); break;
@@ -24,7 +27,7 @@
 }
 
 std::vector<int> Search(const std::string& search) {
-	session.SetStatusBar(Translate::ToString(session.config.service) + ": Requesting search query...");
+	session.SetStatusBar(fmt::format(Strings::Translate("{}: Requesting search query..."), Translate::ToString(session.config.service)));
 
 	switch (session.config.service) {
 		case Anime::Service::AniList: return AniList::Search(search);
@@ -34,7 +37,7 @@
 }
 
 bool GetSeason(Anime::Season season) {
-	session.SetStatusBar(Translate::ToString(session.config.service) + ": Retrieving anime season data...");
+	session.SetStatusBar(fmt::format(Strings::Translate("{}: Retrieving anime season data..."), Translate::ToString(session.config.service)));
 
 	switch (session.config.service) {
 		case Anime::Service::AniList: return AniList::GetSeason(season);
@@ -44,7 +47,7 @@
 }
 
 void UpdateAnimeEntry(int id) {
-	session.SetStatusBar(Translate::ToString(session.config.service) + ": Updating remote anime entry...");
+	session.SetStatusBar(fmt::format(Strings::Translate("{}: Updating remote anime entry..."), Translate::ToString(session.config.service)));
 
 	switch (session.config.service) {
 		case Anime::Service::AniList: AniList::UpdateAnimeEntry(id); break;