Ver código fonte

fix default lang redirection

nas 3 anos atrás
pai
commit
a6bad544a8
4 arquivos alterados com 8 adições e 5 exclusões
  1. 1
    1
      CMakeLists.txt
  2. 1
    1
      src/master.cpp
  3. 4
    2
      src/wiki.cpp
  4. 2
    1
      src/wiki.h

+ 1
- 1
CMakeLists.txt Ver arquivo

@@ -101,7 +101,7 @@ target_link_libraries(wikipp ${BOOSTER} ${CPPCMS} ${CPPDB} ${DISCOUNT})
101 101
 #  Localization
102 102
 
103 103
 
104
-set(LOCALES he ru pl)
104
+set(LOCALES he ru pl fr)
105 105
 
106 106
 set(MO_FILES)
107 107
 set(UPDATE_PO_LIST)

+ 1
- 1
src/master.cpp Ver arquivo

@@ -120,7 +120,7 @@ master::master(wiki &_w) :
120 120
 				lname=p->first;
121 121
 			}
122 122
 		}
123
-		languages[lname]=settings().get<std::string>("wikipp.script") +"/"+ p->first.str();
123
+		languages[lname]=settings().get<std::string>("wikipp.script") +"/"+ settings().get<std::string>("wikipp.language_default");
124 124
 	}
125 125
 	media=settings().get<std::string>("wikipp.media");
126 126
 	syntax_highlighter=settings().get("wikipp.syntax_highlighter","");

+ 4
- 2
src/wiki.cpp Ver arquivo

@@ -24,6 +24,7 @@ wiki::wiki(cppcms::service &srv) :
24 24
 	for(cppcms::json::object::const_iterator p=langs.begin();p!=langs.end();++p) {
25 25
 		lang_map[p->first]=p->second.str();
26 26
 	}
27
+	this->language_default = settings().at("wikipp.language_default").str();
27 28
 }
28 29
 
29 30
 std::string wiki::root(std::string l)
@@ -41,7 +42,8 @@ void wiki::main(std::string url)
41 42
 	if(booster::regex_match(url,res,lang_regex)) {
42 43
 		std::map<std::string,std::string>::const_iterator p = lang_map.find(std::string(res[1]));
43 44
 		if(p==lang_map.end()) {
44
-			page.redirect();
45
+			locale_name = this->language_default ;
46
+			page.redirect( this->language_default );
45 47
 		}
46 48
 		else {
47 49
 			locale_name = p->first;
@@ -51,7 +53,7 @@ void wiki::main(std::string url)
51 53
 		}
52 54
 	}
53 55
 	else
54
-		page.redirect();
56
+		page.redirect( this->language_default );
55 57
 }
56 58
 
57 59
 

+ 2
- 1
src/wiki.h Ver arquivo

@@ -31,7 +31,8 @@ public:
31 31
 	apps::options options;
32 32
 	apps::users users;
33 33
 	apps::index index;
34
-
34
+	std::string language_default;
35
+  
35 36
 	std::string root(std::string locale_name="");
36 37
 	bool set_locale(std::string);
37 38
 	void run(std::string lang,std::string url);

Carregando…
Cancelar
Salvar