2002-04-29 15:56:36 +00:00
|
|
|
/*
|
|
|
|
* \file frnt_lang.C
|
|
|
|
* Copyright 2002 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author Angus Leeming, a.leeming@ic.ac.uk
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "frnt_lang.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
#include "language.h"
|
2002-04-30 15:07:03 +00:00
|
|
|
#include <iostream>
|
2002-04-30 16:12:49 +00:00
|
|
|
#include <algorithm>
|
2002-04-29 15:56:36 +00:00
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
|
2002-04-30 15:07:03 +00:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
struct Sorter {
|
|
|
|
bool operator()(frnt::LanguagePair const & lhs,
|
|
|
|
frnt::LanguagePair const & rhs) const
|
|
|
|
{
|
|
|
|
return lhs.first < rhs.first;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace anon
|
|
|
|
|
2002-04-29 15:56:36 +00:00
|
|
|
namespace frnt {
|
|
|
|
|
2002-04-30 15:07:03 +00:00
|
|
|
vector<LanguagePair> const getLanguageData(bool character_dlg)
|
2002-04-29 15:56:36 +00:00
|
|
|
{
|
2002-04-30 15:07:03 +00:00
|
|
|
vector<LanguagePair>::size_type const size = character_dlg ?
|
|
|
|
languages.size() + 2 : languages.size();
|
2002-04-29 15:56:36 +00:00
|
|
|
|
2002-04-30 15:07:03 +00:00
|
|
|
vector<LanguagePair> langs(size);
|
2002-04-29 15:56:36 +00:00
|
|
|
|
2002-04-30 15:07:03 +00:00
|
|
|
if (character_dlg) {
|
2002-05-01 14:43:38 +00:00
|
|
|
langs[0].first = N_("No change"); langs[0].second = "ignore";
|
|
|
|
langs[1].first = N_("Reset"); langs[1].second = "reset";
|
2002-04-30 15:07:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
vector<string>::size_type i = character_dlg ? 2 : 0;
|
2002-04-29 15:56:36 +00:00
|
|
|
for (Languages::const_iterator cit = languages.begin();
|
|
|
|
cit != languages.end(); ++cit) {
|
2002-04-30 15:07:03 +00:00
|
|
|
langs[i].first = _(cit->second.display());
|
2002-04-29 15:56:36 +00:00
|
|
|
langs[i].second = cit->second.lang();
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
2002-05-01 14:43:38 +00:00
|
|
|
// Don't sort "ignore" and "reset"
|
|
|
|
vector<LanguagePair>::iterator begin = character_dlg ?
|
|
|
|
langs.begin() + 2 : langs.begin();
|
|
|
|
|
|
|
|
std::sort(begin, langs.end(), Sorter());
|
2002-04-30 15:07:03 +00:00
|
|
|
|
2002-04-29 15:56:36 +00:00
|
|
|
return langs;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frnt
|