Añadida traducción de la creación de stressUI.cf

Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
Somebody Master 2020-10-28 20:25:16 +01:00
parent 819f45f32a
commit de30e69a5c
Signed by: somebody_master
GPG Key ID: 78315CFDF0B25505
7 changed files with 56 additions and 7 deletions

View File

@ -1,6 +1,7 @@
#include "config.hpp" #include "config.hpp"
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <sstream>
#ifndef __CONFIG_FILE_HPP_ #ifndef __CONFIG_FILE_HPP_
#define __CONFIG_FILE_HPP_ #define __CONFIG_FILE_HPP_
namespace cf { namespace cf {
@ -9,5 +10,6 @@ namespace cf {
void closeConfig(Config *config); void closeConfig(Config *config);
std::string getLine(std::ifstream *file); std::string getLine(std::ifstream *file);
void saveConfig(Config *config); void saveConfig(Config *config);
void escribirText(std::ofstream *file, std::string *text, int numSpcs);
} // namespace cf } // namespace cf
#endif // __CONFIG_FILE_HPP_ #endif // __CONFIG_FILE_HPP_

View File

@ -22,6 +22,8 @@ namespace en{
const extern std::string confTiempoInput = "- Execution time\t> "; const extern std::string confTiempoInput = "- Execution time\t> ";
const extern std::string confHilosError = "Must introduce a number"; const extern std::string confHilosError = "Must introduce a number";
const extern std::string confTiempoError = "The time format must be HH:mm:ss"; const extern std::string confTiempoError = "The time format must be HH:mm:ss";
const extern std::string confArchText_1 = "Autogenerated file by Stress_UI";
const extern std::string confArchText_2 = "Do not edit manually without knowing what you do";
} }
#endif // __EN_HPP_ #endif // __EN_HPP_

View File

@ -22,6 +22,8 @@ namespace es{
const extern std::string confTiempoInput = "- Tiempo de ejecución\t> "; const extern std::string confTiempoInput = "- Tiempo de ejecución\t> ";
const extern std::string confHilosError = "Se debe introducir un número"; const extern std::string confHilosError = "Se debe introducir un número";
const extern std::string confTiempoError = "El formato del tiempo debe ser HH:mm:ss"; const extern std::string confTiempoError = "El formato del tiempo debe ser HH:mm:ss";
const extern std::string confArchText_1 = "Archivo autogenerado por Stress_UI";
const extern std::string confArchText_2 = "No editar manualmente sin saber lo que se hace";
} }
#endif // __ES_HPP_ #endif // __ES_HPP_

View File

@ -22,6 +22,8 @@ namespace gl{
const extern std::string confTiempoInput = "- Tempo de execución\t> "; const extern std::string confTiempoInput = "- Tempo de execución\t> ";
const extern std::string confHilosError = "Debese introducir un número"; const extern std::string confHilosError = "Debese introducir un número";
const extern std::string confTiempoError = "O formato do tempo debe ser HH:mm:ss"; const extern std::string confTiempoError = "O formato do tempo debe ser HH:mm:ss";
const extern std::string confArchText_1 = "Archivo autoxenerado por Stress_UI";
const extern std::string confArchText_2 = "Non editar manualmente sin saber o que se fai";
} }
#endif // __GL_HPP_ #endif // __GL_HPP_

View File

@ -22,6 +22,8 @@ namespace txt{
extern std::string g_confTiempoInput; extern std::string g_confTiempoInput;
extern std::string g_confHilosError; extern std::string g_confHilosError;
extern std::string g_confTiempoError; extern std::string g_confTiempoError;
extern std::string g_confArchText_1;
extern std::string g_confArchText_2;
void inicializarIdioma(std::string idioma); void inicializarIdioma(std::string idioma);
} }

View File

@ -1,5 +1,5 @@
#include "configFile.hpp" #include "configFile.hpp"
#include <sstream> #include "textos.hpp"
Config cf::openConfig() { Config cf::openConfig() {
std::ifstream file; std::ifstream file;
@ -48,7 +48,8 @@ std::string cf::getLine(std::ifstream *file) {
void cf::saveConfig(Config *config) { void cf::saveConfig(Config *config) {
std::ofstream file(g_configFile); std::ofstream file(g_configFile);
file << "#######################################################################" << std::endl; std::string header = "#######################################################################";
file << header << std::endl;
file << "# + + + + #" << std::endl; file << "# + + + + #" << std::endl;
file << "# + + + #" << std::endl; file << "# + + + #" << std::endl;
file << "# + + #" << std::endl; file << "# + + #" << std::endl;
@ -64,12 +65,40 @@ void cf::saveConfig(Config *config) {
file << "# | | | | | : . | ; ; | #" << std::endl; file << "# | | | | | : . | ; ; | #" << std::endl;
file << "# : : . . . : #" << std::endl; file << "# : : . . . : #" << std::endl;
file << "# #" << std::endl; file << "# #" << std::endl;
file << "# Archivo autogenerado por Stress_UI #" << std::endl;
file << "# No editar manualmente sin saber lo que se hace #" << std::endl; cf::escribirText(&file, &txt::g_confArchText_1, header.length());
file << "#######################################################################" << std::endl;
cf::escribirText(&file, &txt::g_confArchText_2, header.length());
file << header << std::endl;
file << std::endl; file << std::endl;
file << "Número de hilos\t\t= " << std::to_string(config->getNumHilos()); file << txt::g_confHilosInput.substr(2,txt::g_confHilosInput.find("\t>") - 2) << "\t\t= " << std::to_string(config->getNumHilos());
file << std::endl; file << std::endl;
file << "Tiempo de ejecución\t= " << config->getTiempo(); file << txt::g_confTiempoInput.substr(2,txt::g_confTiempoInput.find("\t>") - 2) << "\t= " << config->getTiempo();
file.close(); file.close();
} }
void cf::escribirText(std::ofstream *file, std::string *text, int numSpcs){
*file << "# " << *text;
for (int i = text->length() + 3; i < numSpcs; i++){
*file << " ";
}
for (int i = 0; i < text->length(); i++) {
if (text->substr(i, 2).compare("á") == 0 |
text->substr(i, 2).compare("é") == 0 |
text->substr(i, 2).compare("í") == 0 |
text->substr(i, 2).compare("ó") == 0 |
text->substr(i, 2).compare("ú") == 0 |
text->substr(i, 2).compare("Á") == 0 |
text->substr(i, 2).compare("É") == 0 |
text->substr(i, 2).compare("Ó") == 0 |
text->substr(i, 2).compare("Ú") == 0 |
text->substr(i, 2).compare("ñ") == 0 |
text->substr(i, 2).compare("Ñ") == 0) {
*file << " ";
}
}
*file << "#" << std::endl;
}

View File

@ -22,6 +22,8 @@ std::string txt::g_confHilosInput = "";
std::string txt::g_confTiempoInput = ""; std::string txt::g_confTiempoInput = "";
std::string txt::g_confHilosError = ""; std::string txt::g_confHilosError = "";
std::string txt::g_confTiempoError = ""; std::string txt::g_confTiempoError = "";
std::string txt::g_confArchText_1 = "";
std::string txt::g_confArchText_2 = "";
void txt::inicializarIdioma(std::string idioma){ void txt::inicializarIdioma(std::string idioma){
idioma = idioma.substr(0, idioma.find("_")); idioma = idioma.substr(0, idioma.find("_"));
@ -47,6 +49,8 @@ void txt::inicializarIdioma(std::string idioma){
txt::g_confTiempoInput = confTiempoInput; txt::g_confTiempoInput = confTiempoInput;
txt::g_confHilosError = confHilosError; txt::g_confHilosError = confHilosError;
txt::g_confTiempoError = confTiempoError; txt::g_confTiempoError = confTiempoError;
txt::g_confArchText_1 = confArchText_1;
txt::g_confArchText_2 = confArchText_2;
}else if(idioma == "es"){ }else if(idioma == "es"){
using namespace es; using namespace es;
txt::g_noColor = noColor; txt::g_noColor = noColor;
@ -68,6 +72,8 @@ void txt::inicializarIdioma(std::string idioma){
txt::g_confTiempoInput = confTiempoInput; txt::g_confTiempoInput = confTiempoInput;
txt::g_confHilosError = confHilosError; txt::g_confHilosError = confHilosError;
txt::g_confTiempoError = confTiempoError; txt::g_confTiempoError = confTiempoError;
txt::g_confArchText_1 = confArchText_1;
txt::g_confArchText_2 = confArchText_2;
}else if(idioma == "en"){ }else if(idioma == "en"){
using namespace en; using namespace en;
txt::g_noColor = noColor; txt::g_noColor = noColor;
@ -89,6 +95,8 @@ void txt::inicializarIdioma(std::string idioma){
txt::g_confTiempoInput = confTiempoInput; txt::g_confTiempoInput = confTiempoInput;
txt::g_confHilosError = confHilosError; txt::g_confHilosError = confHilosError;
txt::g_confTiempoError = confTiempoError; txt::g_confTiempoError = confTiempoError;
txt::g_confArchText_1 = confArchText_1;
txt::g_confArchText_2 = confArchText_2;
}else{ }else{
using namespace en; using namespace en;
txt::g_noColor = noColor; txt::g_noColor = noColor;
@ -110,6 +118,8 @@ void txt::inicializarIdioma(std::string idioma){
txt::g_confTiempoInput = confTiempoInput; txt::g_confTiempoInput = confTiempoInput;
txt::g_confHilosError = confHilosError; txt::g_confHilosError = confHilosError;
txt::g_confTiempoError = confTiempoError; txt::g_confTiempoError = confTiempoError;
txt::g_confArchText_1 = confArchText_1;
txt::g_confArchText_2 = confArchText_2;
} }
} }