changed: html templates are a part of winix now and the user can provide special html templates for its site added: locales added: html templates are using HtmlFilter now (locales) changed: now we have html templates for each language git-svn-id: svn://ttmath.org/publicrep/winix/trunk@560 e52654a7-88a9-db11-a3e9-0013d4bc506e
67 lines
1.2 KiB
C++
Executable File
67 lines
1.2 KiB
C++
Executable File
/*
|
|
* This file is a part of CMSLU -- Content Management System like Unix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfilecmslucorelocale
|
|
#define headerfilecmslucorelocale
|
|
|
|
#include "../confparser/confparser.h"
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
|
|
|
|
class Locale
|
|
{
|
|
public:
|
|
|
|
enum Lang
|
|
{
|
|
lang_en = 0,
|
|
lang_pl,
|
|
|
|
lang_unknown // should be last
|
|
};
|
|
|
|
Locale();
|
|
|
|
void Read(const char * dir, const char * dir_def = 0);
|
|
void Read(const std::string & dir, const std::string & dir_def);
|
|
const std::string & Get(const std::string & key) const;
|
|
|
|
// default is english
|
|
void SetLang(Lang lang);
|
|
Lang GetLang();
|
|
|
|
// which language is used instead if there is no a key in an other language
|
|
// default: lang_en
|
|
void SetLangDef(Lang lang);
|
|
|
|
|
|
static Lang StrToLang(const std::string & str);
|
|
static const char * LangToStr(Lang lang);
|
|
|
|
size_t Size();
|
|
|
|
private:
|
|
|
|
void AddLocale(Lang lang);
|
|
void ReadFile(const char * dir, const char * dir_def, Lang lang, const char * file);
|
|
|
|
|
|
std::vector<ConfParser::Table> loc_tab;
|
|
ConfParser loc_parser;
|
|
std::string file_name;
|
|
std::string empty;
|
|
Lang default_lang;
|
|
Lang current_lang;
|
|
};
|
|
|
|
|
|
#endif
|