diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d1fa05..9b94318 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/master.cpp b/src/master.cpp index 6284e9c..911bd9c 100644 --- a/src/master.cpp +++ b/src/master.cpp @@ -120,7 +120,7 @@ master::master(wiki &_w) : lname=p->first; } } - languages[lname]=settings().get("wikipp.script") +"/"+ p->first.str(); + languages[lname]=settings().get("wikipp.script") +"/"+ settings().get("wikipp.language_default"); } media=settings().get("wikipp.media"); syntax_highlighter=settings().get("wikipp.syntax_highlighter",""); diff --git a/src/wiki.cpp b/src/wiki.cpp index 531c6bf..07b2359 100644 --- a/src/wiki.cpp +++ b/src/wiki.cpp @@ -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::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 ); } diff --git a/src/wiki.h b/src/wiki.h index 17b009c..5f58d40 100644 --- a/src/wiki.h +++ b/src/wiki.h @@ -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);