mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Clean-up yesterday's code-splurge and sort the translated language names.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4095 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2c35ae62a6
commit
ac926e5f0a
@ -1,3 +1,12 @@
|
|||||||
|
2002-04-30 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
|
* frnt_lang.[Ch] (getLanguageData): passed a bool character_dlg.
|
||||||
|
If the the caller is the character dialog, add "No change" and "Reset"
|
||||||
|
to the vector, else don't.
|
||||||
|
Internationalise the GUI strings here rather than in the different
|
||||||
|
calling dialogs.
|
||||||
|
Sort the translated strings, albeit simply.
|
||||||
|
|
||||||
2002-04-29 Angus Leeming <a.leeming@ic.ac.uk>
|
2002-04-29 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* character.[Ch]: rename namespace character as namespace frnt.
|
* character.[Ch]: rename namespace character as namespace frnt.
|
||||||
|
@ -15,26 +15,46 @@
|
|||||||
#include "frnt_lang.h"
|
#include "frnt_lang.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
struct Sorter {
|
||||||
|
bool operator()(frnt::LanguagePair const & lhs,
|
||||||
|
frnt::LanguagePair const & rhs) const
|
||||||
|
{
|
||||||
|
return lhs.first < rhs.first;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace anon
|
||||||
|
|
||||||
namespace frnt {
|
namespace frnt {
|
||||||
|
|
||||||
vector<LanguagePair> const getLanguageData()
|
vector<LanguagePair> const getLanguageData(bool character_dlg)
|
||||||
{
|
{
|
||||||
vector<LanguagePair> langs(languages.size() + 2);
|
vector<LanguagePair>::size_type const size = character_dlg ?
|
||||||
|
languages.size() + 2 : languages.size();
|
||||||
|
|
||||||
langs[0].first = N_("No change"); langs[0].second = "No change";
|
vector<LanguagePair> langs(size);
|
||||||
langs[1].first = N_("Reset"); langs[1].second = "Reset";
|
|
||||||
|
|
||||||
vector<string>::size_type i = 2;
|
if (character_dlg) {
|
||||||
|
langs[0].first = N_("No change"); langs[0].second = "No change";
|
||||||
|
langs[1].first = N_("Reset"); langs[1].second = "Reset";
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<string>::size_type i = character_dlg ? 2 : 0;
|
||||||
for (Languages::const_iterator cit = languages.begin();
|
for (Languages::const_iterator cit = languages.begin();
|
||||||
cit != languages.end(); ++cit) {
|
cit != languages.end(); ++cit) {
|
||||||
langs[i].first = cit->second.display();
|
langs[i].first = _(cit->second.display());
|
||||||
langs[i].second = cit->second.lang();
|
langs[i].second = cit->second.lang();
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::sort(langs.begin(), langs.end(), Sorter());
|
||||||
|
|
||||||
return langs;
|
return langs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,8 +23,10 @@
|
|||||||
namespace frnt {
|
namespace frnt {
|
||||||
///
|
///
|
||||||
typedef std::pair<string, string> LanguagePair;
|
typedef std::pair<string, string> LanguagePair;
|
||||||
///
|
/** If the caller is the character dialog, add "No change" and "Reset"
|
||||||
std::vector<LanguagePair> const getLanguageData();
|
* to the vector.
|
||||||
|
*/
|
||||||
|
std::vector<LanguagePair> const getLanguageData(bool character_dlg);
|
||||||
|
|
||||||
} // namespace frnt
|
} // namespace frnt
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2002-04-30 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
|
* FormCharacter.C:
|
||||||
|
* FormDocument.C:
|
||||||
|
* FormPreferences.C: use the bool flag to getLanguageData as
|
||||||
|
appropriate. No longer translate the strings as this is done in
|
||||||
|
getLanguageData.
|
||||||
|
|
||||||
2002-04-29 Angus Leeming <a.leeming@ic.ac.uk>
|
2002-04-29 Angus Leeming <a.leeming@ic.ac.uk>
|
||||||
|
|
||||||
* FormCharacter.h:
|
* FormCharacter.h:
|
||||||
|
@ -48,13 +48,13 @@ void FormCharacter::build()
|
|||||||
{
|
{
|
||||||
dialog_.reset(build_character());
|
dialog_.reset(build_character());
|
||||||
|
|
||||||
vector<FamilyPair> const family = getFamilyData();
|
vector<FamilyPair> const family = getFamilyData();
|
||||||
vector<SeriesPair> const series = getSeriesData();
|
vector<SeriesPair> const series = getSeriesData();
|
||||||
vector<ShapePair> const shape = getShapeData();
|
vector<ShapePair> const shape = getShapeData();
|
||||||
vector<SizePair> const size = getSizeData();
|
vector<SizePair> const size = getSizeData();
|
||||||
vector<BarPair> const bar = getBarData();
|
vector<BarPair> const bar = getBarData();
|
||||||
vector<ColorPair> const color = getColorData();
|
vector<ColorPair> const color = getColorData();
|
||||||
vector<LanguagePair> const langs = getLanguageData();
|
vector<LanguagePair> const langs = getLanguageData(true);
|
||||||
|
|
||||||
// Store the identifiers for later
|
// Store the identifiers for later
|
||||||
family_ = getSecond(family);
|
family_ = getSecond(family);
|
||||||
@ -103,7 +103,7 @@ void FormCharacter::build()
|
|||||||
vector<LanguagePair>::const_iterator it = langs.begin();
|
vector<LanguagePair>::const_iterator it = langs.begin();
|
||||||
vector<LanguagePair>::const_iterator end = langs.end();
|
vector<LanguagePair>::const_iterator end = langs.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
combo_language2_->addto(_(it->first));
|
combo_language2_->addto(it->first);
|
||||||
}
|
}
|
||||||
combo_language2_->select(1);
|
combo_language2_->select(1);
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ void FormDocument::build()
|
|||||||
"default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
|
"default|auto|latin1|latin2|latin3|latin4|latin5|latin9"
|
||||||
"|koi8-r|koi8-u|cp866|cp1251|iso88595");
|
"|koi8-r|koi8-u|cp866|cp1251|iso88595");
|
||||||
|
|
||||||
vector<frnt::LanguagePair> const langs = frnt::getLanguageData();
|
vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
|
||||||
// Store the identifiers for later
|
// Store the identifiers for later
|
||||||
lang_ = getSecond(langs);
|
lang_ = getSecond(langs);
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ void FormDocument::build()
|
|||||||
vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
|
vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
|
||||||
vector<frnt::LanguagePair>::const_iterator lend = langs.end();
|
vector<frnt::LanguagePair>::const_iterator lend = langs.end();
|
||||||
for (; lit != lend; ++lit) {
|
for (; lit != lend; ++lit) {
|
||||||
combo_language->addto(_(lit->first));
|
combo_language->addto(lit->first);
|
||||||
}
|
}
|
||||||
combo_language->select(1);
|
combo_language->select(1);
|
||||||
|
|
||||||
|
@ -1633,7 +1633,7 @@ void FormPreferences::Language::build()
|
|||||||
fl_set_input_return(dialog_->input_command_end, FL_RETURN_CHANGED);
|
fl_set_input_return(dialog_->input_command_end, FL_RETURN_CHANGED);
|
||||||
|
|
||||||
// Store the lang identifiers for later
|
// Store the lang identifiers for later
|
||||||
vector<frnt::LanguagePair> const langs = frnt::getLanguageData();
|
vector<frnt::LanguagePair> const langs = frnt::getLanguageData(false);
|
||||||
lang_ = getSecond(langs);
|
lang_ = getSecond(langs);
|
||||||
|
|
||||||
// The default_language is a combo-box and has to be inserted manually
|
// The default_language is a combo-box and has to be inserted manually
|
||||||
@ -1652,7 +1652,7 @@ void FormPreferences::Language::build()
|
|||||||
vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
|
vector<frnt::LanguagePair>::const_iterator lit = langs.begin();
|
||||||
vector<frnt::LanguagePair>::const_iterator lend = langs.end();
|
vector<frnt::LanguagePair>::const_iterator lend = langs.end();
|
||||||
for (; lit != lend; ++lit) {
|
for (; lit != lend; ++lit) {
|
||||||
combo_default_lang->addto(_(lit->first));
|
combo_default_lang->addto(lit->first);
|
||||||
}
|
}
|
||||||
combo_default_lang->select(1);
|
combo_default_lang->select(1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user