The campaign server now makes note of translations when uploading campaigns.

The heuristic is that the parent directories of directories named
"LC_MESSAGES" are taken to be language codes with the exception that
subdirectories of directories named "LC_MESSAGES" aren't looked at.
This commit is contained in:
Bruno Wolff III 2005-10-11 00:08:53 +00:00
parent ba63d0f7f3
commit 8942179063
2 changed files with 17 additions and 0 deletions

View file

@ -38,6 +38,7 @@ SVN trunk:
* filter by name
* filter by last update time (before or after)
* campaign_list response now contains the time the request was processed
* campaign_list response now contains information about translations
* utils: added weblist.pl and webtgz.pl web interface programs
Version 1.0rc1:

View file

@ -73,6 +73,21 @@ campaign_server::campaign_server(const std::string& cfgfile)
}
}
void find_translations(const config& cfg, config& campaign)
{
const config::child_list& dirs = cfg.get_children("dir");
for(config::child_list::const_iterator i = dirs.begin(); i != dirs.end(); ++i) {
if((const t_string)(**i)["name"] == "LC_MESSAGES") {
config* language = &campaign.add_child("translation");
(*language)["language"] = cfg["name"];
}
else {
find_translations(**i, campaign);
}
}
}
void campaign_server::run()
{
for(int increment = 0; ; ++increment) {
@ -185,6 +200,7 @@ void campaign_server::run()
(*data)["version"] = (*campaign)["version"];
(*data)["timestamp"] = (*campaign)["timestamp"];
(*data)["icon"] = (*campaign)["icon"];
find_translations(*data, *campaign);
{
scoped_ostream campaign_file = ostream_file(filename);
write_compressed(*campaign_file, *data);