eliminat Options::console

This commit is contained in:
2026-03-29 18:14:51 +02:00
parent fd9be2066d
commit 3b233f0e12
6 changed files with 34 additions and 111 deletions

View File

@@ -5,7 +5,6 @@
#include <string>
#include "external/fkyaml_node.hpp" // Para fkyaml::node
#include "game/options.hpp" // Para Options::console
// [SINGLETON]
Locale* Locale::instance = nullptr;
@@ -34,9 +33,7 @@ auto Locale::get(const std::string& key) const -> std::string { // NOLINT(reada
return it->second;
}
if (Options::console) {
std::cerr << "Locale: clave no encontrada: " << key << '\n';
}
std::cerr << "Locale: clave no encontrada: " << key << '\n';
return key;
}
@@ -61,17 +58,13 @@ void Locale::flatten(const void* node_ptr, const std::string& prefix) { // NOLI
// Carga las traducciones desde el fichero YAML indicado
void Locale::loadFromFile(const std::string& file_path) { // NOLINT(readability-convert-member-functions-to-static)
if (file_path.empty()) {
if (Options::console) {
std::cerr << "Locale: ruta de fichero vacía, sin traducciones cargadas\n";
}
std::cerr << "Locale: ruta de fichero vacía, sin traducciones cargadas\n";
return;
}
std::ifstream file(file_path);
if (!file.is_open()) {
if (Options::console) {
std::cerr << "Locale: no se puede abrir " << file_path << '\n';
}
std::cerr << "Locale: no se puede abrir " << file_path << '\n';
return;
}
@@ -79,12 +72,8 @@ void Locale::loadFromFile(const std::string& file_path) { // NOLINT(readability
auto yaml = fkyaml::node::deserialize(file);
flatten(&yaml, "");
if (Options::console) {
std::cout << "Locale: " << strings_.size() << " traducciones cargadas desde " << file_path << '\n';
}
std::cout << "Locale: " << strings_.size() << " traducciones cargadas desde " << file_path << '\n';
} catch (const fkyaml::exception& e) {
if (Options::console) {
std::cerr << "Locale: error al parsear YAML: " << e.what() << '\n';
}
std::cerr << "Locale: error al parsear YAML: " << e.what() << '\n';
}
}