Internationalise the language names in the character dialog's combox.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4086 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-04-29 14:26:42 +00:00
parent 3b9f84afb3
commit 93ad5c74f1
7 changed files with 60 additions and 35 deletions

View File

@ -1,3 +1,12 @@
2002-04-29 Angus Leeming <a.leeming@ic.ac.uk>
* character.[Ch] (getLanguageData): returns a vector<LanguagePair>
where LanguagePair is a display string and an identifying string.
The display string is internationalised.
* ControlCharacter.C (getLanguage, setLanguage): Do not internationalise
the identifying strings, "No change" and "Reset".
2002-04-25 Herbert Voss <voss@lyx.org>
* ControlSendto.C (allFormats): don't add the graphics extensions to the

View File

@ -220,16 +220,16 @@ string ControlCharacter::getLanguage() const
{
if (font_.get() && font_->language())
return font_->language()->lang();
return _("No change");
return "No change";
}
void ControlCharacter::setLanguage(string const & val)
{
if (val == _("No change"))
if (val == "No change")
font_->setLanguage(ignore_language);
else if (val == _("Reset"))
else if (val == "Reset")
font_->setLanguage(lv_.buffer()->params.language);
else

View File

@ -176,17 +176,19 @@ vector<ColorPair> const getColorData()
}
vector<string> const getLanguageData()
vector<LanguagePair> const getLanguageData()
{
vector<string> langs(languages.size() + 2);
vector<LanguagePair> langs(languages.size() + 2);
langs[0] = _("No change");
langs[1] = _("Reset");
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 = 1;
vector<string>::size_type i = 2;
for (Languages::const_iterator cit = languages.begin();
cit != languages.end(); ++cit) {
langs[++i] = cit->second.lang();
langs[i].first = cit->second.display();
langs[i].second = cit->second.lang();
++i;
}
return langs;

View File

@ -50,21 +50,23 @@ namespace character {
typedef std::pair<string, FONT_STATE> BarPair;
///
typedef std::pair<string, LColor::color> ColorPair;
///
typedef std::pair<string, string> LanguagePair;
///
std::vector<FamilyPair> const getFamilyData();
std::vector<FamilyPair> const getFamilyData();
///
std::vector<SeriesPair> const getSeriesData();
std::vector<SeriesPair> const getSeriesData();
///
std::vector<ShapePair> const getShapeData();
std::vector<ShapePair> const getShapeData();
///
std::vector<SizePair> const getSizeData();
std::vector<SizePair> const getSizeData();
///
std::vector<BarPair> const getBarData();
std::vector<BarPair> const getBarData();
///
std::vector<ColorPair> const getColorData();
std::vector<ColorPair> const getColorData();
///
std::vector<string> const getLanguageData();
std::vector<LanguagePair> const getLanguageData();
} // namespace character

View File

@ -1,3 +1,10 @@
2002-04-29 Angus Leeming <a.leeming@ic.ac.uk>
* FormCharacter.h: store a vector<string> lang_ of language identifiers.
* FormCharacter.C: changes associated with character::getLanguageData
returning a vector<LanguagePair> rather than a vector<string>.
2002-04-26 John Levon <moz@compsoc.man.ac.uk>
* FormMathsPanel.C: translate Close

View File

@ -47,21 +47,22 @@ void FormCharacter::build()
{
dialog_.reset(build_character());
vector<FamilyPair> const family = getFamilyData();
vector<SeriesPair> const series = getSeriesData();
vector<ShapePair> const shape = getShapeData();
vector<SizePair> const size = getSizeData();
vector<BarPair> const bar = getBarData();
vector<ColorPair> const color = getColorData();
vector<string> const language = getLanguageData();
vector<FamilyPair> const family = getFamilyData();
vector<SeriesPair> const series = getSeriesData();
vector<ShapePair> const shape = getShapeData();
vector<SizePair> const size = getSizeData();
vector<BarPair> const bar = getBarData();
vector<ColorPair> const color = getColorData();
vector<LanguagePair> const language = getLanguageData();
// Store the enums for later
// Store the identifiers for later
family_ = getSecond(family);
series_ = getSecond(series);
shape_ = getSecond(shape);
size_ = getSecond(size);
bar_ = getSecond(bar);
color_ = getSecond(color);
shape_ = getSecond(shape);
size_ = getSecond(size);
bar_ = getSecond(bar);
color_ = getSecond(color);
lang_ = getSecond(language);
// create a string of entries " entry1 | entry2 | entry3 | entry4 "
// with which to initialise the xforms choice object.
@ -98,11 +99,11 @@ void FormCharacter::build()
fl_end_form();
// build up the combox entries
for (vector<string>::const_iterator cit = language.begin();
for (vector<LanguagePair>::const_iterator cit = language.begin();
cit != language.end(); ++cit) {
combo_language2_->addto(*cit);
combo_language2_->addto(_(cit->first));
}
combo_language2_->select(*language.begin());
combo_language2_->select(1);
// Manage the ok, apply and cancel/close buttons
bc().setApply(dialog_->button_apply);
@ -133,7 +134,8 @@ void FormCharacter::apply()
pos = fl_get_choice(dialog_->choice_color);
controller().setColor(color_[pos-1]);
controller().setLanguage(combo_language2_->getline());
pos = combo_language2_->get();
controller().setLanguage(lang_[pos-1]);
bool const toggleall = fl_get_button(dialog_->check_toggle_all);
controller().setToggleAll(toggleall);
@ -175,7 +177,8 @@ void FormCharacter::update()
pos = int(findPos(color_, controller().getColor()));
fl_set_choice(dialog_->choice_color, pos+1);
combo_language2_->select(controller().getLanguage());
pos = int(findPos(lang_, controller().getLanguage()));
combo_language2_->select(pos+1);
fl_set_button(dialog_->check_toggle_all, controller().getToggleAll());
}
@ -209,8 +212,8 @@ ButtonPolicy::SMInput FormCharacter::input(FL_OBJECT *, long)
if (color_[pos-1] != LColor::ignore)
activate = ButtonPolicy::SMI_VALID;
string const language = combo_language2_->getline();
if (language != _("No change"))
pos = combo_language2_->get();
if (lang_[pos-1] != "No change")
activate = ButtonPolicy::SMI_VALID;
return activate;

View File

@ -71,6 +71,8 @@ private:
std::vector<character::FONT_STATE> bar_;
///
std::vector<LColor::color> color_;
///
std::vector<string> lang_;
};
#endif