Change to show english comments
This commit is contained in:
parent
1e9e63ad9f
commit
1d889a4244
@ -14,21 +14,19 @@
|
|||||||
|
|
||||||
struct TurnInstructionsListClass {
|
struct TurnInstructionsListClass {
|
||||||
|
|
||||||
// Clase en la que recorreremos la estructura en directorios
|
// Class to go over directory hierachy
|
||||||
list<TurnInstructionsClass> tilist;
|
list<TurnInstructionsClass> tilist;
|
||||||
vector<string> languages;
|
vector<string> languages;
|
||||||
|
|
||||||
// Constructor vacio
|
|
||||||
TurnInstructionsListClass(){};
|
TurnInstructionsListClass(){};
|
||||||
|
|
||||||
// Constructor
|
|
||||||
TurnInstructionsListClass(std::string path){
|
TurnInstructionsListClass(std::string path){
|
||||||
vector<string> archivos;
|
vector<string> archivos;
|
||||||
vector<string>::iterator posArchivo;
|
vector<string>::iterator posArchivo;
|
||||||
posArchivo = archivos.begin();
|
posArchivo = archivos.begin();
|
||||||
FindFile(path.c_str(), archivos);
|
FindFile(path.c_str(), archivos);
|
||||||
TurnInstructionsClass ti;
|
TurnInstructionsClass ti;
|
||||||
// Vector con los nombres de los archivos a leer
|
// Vector with the file names to read
|
||||||
for (int i = 0; i < archivos.size(); ++i){
|
for (int i = 0; i < archivos.size(); ++i){
|
||||||
ti = TurnInstructionsClass(archivos.at(i));
|
ti = TurnInstructionsClass(archivos.at(i));
|
||||||
posArchivo++;
|
posArchivo++;
|
||||||
@ -39,15 +37,15 @@ struct TurnInstructionsListClass {
|
|||||||
void FindFile (const char dirname[], vector<string> &archivos){
|
void FindFile (const char dirname[], vector<string> &archivos){
|
||||||
static DIR *dir;
|
static DIR *dir;
|
||||||
static struct dirent *mi_dirent;
|
static struct dirent *mi_dirent;
|
||||||
// Comprobar que se abre el directorio
|
// Check if the directory have opened correctly
|
||||||
if((dir = opendir(dirname)) == NULL)
|
if((dir = opendir(dirname)) == NULL)
|
||||||
cout << "Fault in opendir" << endl;;
|
cout << "Fault in opendir" << endl;;
|
||||||
// Recorremos el contenido del directorio
|
// Go over directory content
|
||||||
while ((mi_dirent = readdir(dir)) != NULL){
|
while ((mi_dirent = readdir(dir)) != NULL){
|
||||||
// Si no es él mismo (.) o el padre (..)
|
// If it's not (.) or (..)
|
||||||
if (strcmp (mi_dirent->d_name, ".") != 0 && strcmp (mi_dirent->d_name, "..") != 0){
|
if (strcmp (mi_dirent->d_name, ".") != 0 && strcmp (mi_dirent->d_name, "..") != 0){
|
||||||
struct stat structura;
|
struct stat structura;
|
||||||
// Leer la ruta completa
|
// Read the complete path
|
||||||
string dirnameString = dirname;
|
string dirnameString = dirname;
|
||||||
string nameFile = mi_dirent->d_name;
|
string nameFile = mi_dirent->d_name;
|
||||||
string pathFile = dirnameString + "/" + nameFile;
|
string pathFile = dirnameString + "/" + nameFile;
|
||||||
@ -73,7 +71,7 @@ struct TurnInstructionsListClass {
|
|||||||
boost::to_upper(language);
|
boost::to_upper(language);
|
||||||
list <TurnInstructionsClass>::iterator pos;
|
list <TurnInstructionsClass>::iterator pos;
|
||||||
int index = -1;
|
int index = -1;
|
||||||
// Cuando no se le pasa ningún idioma
|
// In case the language is empty
|
||||||
if(index == -1 && language == ""){
|
if(index == -1 && language == ""){
|
||||||
for(int i=0; i<languages.size(); i++){
|
for(int i=0; i<languages.size(); i++){
|
||||||
if(languages.at(i).find("EN")==0){
|
if(languages.at(i).find("EN")==0){
|
||||||
@ -82,14 +80,15 @@ struct TurnInstructionsListClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cuando se le pasa por parametro lang=ES_ES y lo que tenemos es ES_ES
|
// In case the request language is the same name than we have in the directory hierachy
|
||||||
for(int i=0; i<languages.size(); i++){
|
for(int i=0; i<languages.size(); i++){
|
||||||
if(language.compare(languages.at(i)) == 0){
|
if(language.compare(languages.at(i)) == 0){
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cuando se le pasa por parametro lang=ES y lo que tenemos es ES_ES
|
// In case the request language is the same language but the name is not exactly the same
|
||||||
|
// Example: Request parameter: 'lang=ES' and file name is 'ES_ES'
|
||||||
if(index == -1){
|
if(index == -1){
|
||||||
for(int i=0; i<languages.size(); i++){
|
for(int i=0; i<languages.size(); i++){
|
||||||
if(language != "" && languages.at(i).find(language)==0){
|
if(language != "" && languages.at(i).find(language)==0){
|
||||||
@ -98,7 +97,8 @@ struct TurnInstructionsListClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cuando se le pasa por parámetro lang=ES_ES y lo que tenemos es ES
|
// In case the request language is the same language but the name is not exactly the same
|
||||||
|
// Example: Request parameter: 'lang=ES_ES' and file name is 'ES'
|
||||||
if(index == -1){
|
if(index == -1){
|
||||||
for(int i=0; i<languages.size(); i++){
|
for(int i=0; i<languages.size(); i++){
|
||||||
if(language.find(languages.at(i))==0){
|
if(language.find(languages.at(i))==0){
|
||||||
@ -107,7 +107,8 @@ struct TurnInstructionsListClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cuando se le pasa por parámetro ES_AR y tenemos ES debe devolver ES
|
// In case the request language was an included language in another language
|
||||||
|
// Example: Request parameter: 'lang=ES_AR' and file name is 'ES'
|
||||||
if(index == -1){
|
if(index == -1){
|
||||||
for(int i=0; i<languages.size(); i++){
|
for(int i=0; i<languages.size(); i++){
|
||||||
int pos = language.find("_");
|
int pos = language.find("_");
|
||||||
@ -118,7 +119,7 @@ struct TurnInstructionsListClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cuando no encuentra idioma que tome el por defecto EN
|
// In case the request parameter language doesn't exist, the default language is 'EN'
|
||||||
if(index == -1){
|
if(index == -1){
|
||||||
for(int i=0; i<languages.size(); i++){
|
for(int i=0; i<languages.size(); i++){
|
||||||
if(languages.at(i).find("EN")==0){
|
if(languages.at(i).find("EN")==0){
|
||||||
|
|||||||
10
server.ini
10
server.ini
@ -2,10 +2,10 @@ Threads = 8
|
|||||||
IP = 0.0.0.0
|
IP = 0.0.0.0
|
||||||
Port = 5000
|
Port = 5000
|
||||||
|
|
||||||
hsgrData=/home/usuario/workspace/osm/comunidad_de_madrid.osrm.hsgr
|
hsgrData=/opt/osm/germany.osrm.hsgr
|
||||||
nodesData=/home/usuario/workspace/osm/comunidad_de_madrid.osrm.nodes
|
nodesData=/opt/osm/germany.osrm.nodes
|
||||||
ramIndex=/home/usuario/workspace/osm/comunidad_de_madrid.osrm.ramIndex
|
ramIndex=/opt/osm/germany.osrm.ramIndex
|
||||||
fileIndex=/home/usuario/workspace/osm/comunidad_de_madrid.osrm.fileIndex
|
fileIndex=/opt/osm/germany.osrm.fileIndex
|
||||||
namesData=/home/usuario/workspace/osm/comunidad_de_madrid.osrm.names
|
namesData=/opt/osm/germany.osrm.names
|
||||||
|
|
||||||
translations=/home/usuario/workspace/Project-OSRM/DataStructures/languages
|
translations=/home/usuario/workspace/Project-OSRM/DataStructures/languages
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user