fix default lang redirection
This commit is contained in:
parent
cbe37d1e00
commit
a6bad544a8
4 changed files with 8 additions and 5 deletions
|
|
@ -101,7 +101,7 @@ target_link_libraries(wikipp ${BOOSTER} ${CPPCMS} ${CPPDB} ${DISCOUNT})
|
|||
# Localization
|
||||
|
||||
|
||||
set(LOCALES he ru pl)
|
||||
set(LOCALES he ru pl fr)
|
||||
|
||||
set(MO_FILES)
|
||||
set(UPDATE_PO_LIST)
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ master::master(wiki &_w) :
|
|||
lname=p->first;
|
||||
}
|
||||
}
|
||||
languages[lname]=settings().get<std::string>("wikipp.script") +"/"+ p->first.str();
|
||||
languages[lname]=settings().get<std::string>("wikipp.script") +"/"+ settings().get<std::string>("wikipp.language_default");
|
||||
}
|
||||
media=settings().get<std::string>("wikipp.media");
|
||||
syntax_highlighter=settings().get("wikipp.syntax_highlighter","");
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ wiki::wiki(cppcms::service &srv) :
|
|||
for(cppcms::json::object::const_iterator p=langs.begin();p!=langs.end();++p) {
|
||||
lang_map[p->first]=p->second.str();
|
||||
}
|
||||
this->language_default = settings().at("wikipp.language_default").str();
|
||||
}
|
||||
|
||||
std::string wiki::root(std::string l)
|
||||
|
|
@ -41,7 +42,8 @@ void wiki::main(std::string url)
|
|||
if(booster::regex_match(url,res,lang_regex)) {
|
||||
std::map<std::string,std::string>::const_iterator p = lang_map.find(std::string(res[1]));
|
||||
if(p==lang_map.end()) {
|
||||
page.redirect();
|
||||
locale_name = this->language_default ;
|
||||
page.redirect( this->language_default );
|
||||
}
|
||||
else {
|
||||
locale_name = p->first;
|
||||
|
|
@ -51,7 +53,7 @@ void wiki::main(std::string url)
|
|||
}
|
||||
}
|
||||
else
|
||||
page.redirect();
|
||||
page.redirect( this->language_default );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ public:
|
|||
apps::options options;
|
||||
apps::users users;
|
||||
apps::index index;
|
||||
|
||||
std::string language_default;
|
||||
|
||||
std::string root(std::string locale_name="");
|
||||
bool set_locale(std::string);
|
||||
void run(std::string lang,std::string url);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue