* \author Angus Leeming
* \author Herbert Voß
* \author Richard Heck
+ * \author Julien Rioux
*
* Full author contact details are available in file CREDITS.
*/
{}
-docstring const BibTeXInfo::getAbbreviatedAuthor(bool jurabib_style) const
+docstring const BibTeXInfo::getAbbreviatedAuthor(bool jurabib_style, string lang) const
{
if (!is_bibtex_) {
docstring const opt = label();
}
if (authors.size() == 2)
- return bformat(_("%1$s and %2$s"),
+ return bformat(translateIfPossible(from_ascii("%1$s and %2$s"), lang),
familyName(authors[0]), familyName(authors[1]));
if (authors.size() > 2)
- return bformat(_("%1$s et al."), familyName(authors[0]));
+ return bformat(translateIfPossible(from_ascii("%1$s et al."), lang),
+ familyName(authors[0]));
return familyName(authors[0]);
}
static int max_passes = 5000;
docstring ret; // return value
string key;
+ string lang = buf.params().language->code();
bool scanning_key = false;
bool scanning_rich = false;
string const val =
buf.params().documentClass().getCiteMacro(engine_type, key);
docstring const trans =
- translateIfPossible(from_utf8(val), buf.params().language->code());
+ translateIfPossible(from_utf8(val), lang);
ret += trans;
} else {
- docstring const val = getValueForKey(key, before, after, dialog, xref);
+ docstring const val =
+ getValueForKey(key, before, after, dialog, xref, lang);
ret += val;
}
} else {
if (newfmt == fmt) // parse error
return _("ERROR!");
fmt = newfmt;
- docstring const val = getValueForKey(optkey, before, after, dialog, xref);
+ docstring const val =
+ getValueForKey(optkey, before, after, dialog, xref, lang);
if (optkey == "next" && next)
ret += from_utf8(ifpart); // without expansion
else if (!val.empty())
docstring BibTeXInfo::getValueForKey(string const & key,
docstring const & before, docstring const & after, docstring const & dialog,
- BibTeXInfo const * const xref) const
+ BibTeXInfo const * const xref, string lang) const
{
docstring ret = operator[](key);
if (ret.empty() && xref)
return label_;
else if (key == "abbrvauthor")
// Special key to provide abbreviated author names.
- return getAbbreviatedAuthor();
+ return getAbbreviatedAuthor(false, lang);
else if (key == "shortauthor")
// When shortauthor is not defined, jurabib automatically
// provides jurabib-style abbreviated author names. We do
// this as well.
- return getAbbreviatedAuthor(true);
+ return getAbbreviatedAuthor(true, lang);
else if (key == "shorttitle") {
// When shorttitle is not defined, jurabib uses for `article'
// and `periodical' entries the form `journal volume [year]'
}
-docstring const BiblioInfo::getAbbreviatedAuthor(docstring const & key) const
+docstring const BiblioInfo::getAbbreviatedAuthor(docstring const & key, string lang) const
{
BiblioInfo::const_iterator it = find(key);
if (it == end())
return docstring();
BibTeXInfo const & data = it->second;
- return data.getAbbreviatedAuthor();
+ return data.getAbbreviatedAuthor(false, lang);
}
}
-docstring const BiblioInfo::getYear(docstring const & key, bool use_modifier) const
+docstring const BiblioInfo::getYear(docstring const & key, bool use_modifier, string lang) const
{
BiblioInfo::const_iterator it = find(key);
if (it == end())
// let's try the crossref
docstring const xref = data.getXRef();
if (xref.empty())
- return _("No year"); // no luck
+ // no luck
+ return translateIfPossible(from_ascii("No year"), lang);
BiblioInfo::const_iterator const xrefit = find(xref);
if (xrefit == end())
- return _("No year"); // no luck again
+ // no luck again
+ return translateIfPossible(from_ascii("No year"), lang);
BibTeXInfo const & xref_data = xrefit->second;
year = xref_data.getYear();
}
}
} // namespace lyx
-
* \author Angus Leeming
* \author Herbert Voß
* \author Richard Heck
+ * \author Julien Rioux
*
* Full author contact details are available in file CREDITS.
*/
/// constructor that sets the entryType
BibTeXInfo(docstring const & key, docstring const & type);
/// \return the short form of an authorlist
- docstring const getAbbreviatedAuthor(bool jurabib_style = false) const;
+ docstring const getAbbreviatedAuthor(bool jurabib_style = false, std::string lang = "en") const;
///
docstring const getYear() const;
///
/// be the one referenced in the crossref field.
docstring getValueForKey(std::string const & key,
docstring const & before, docstring const & after, docstring const & dialog,
- BibTeXInfo const * const xref = 0) const;
+ BibTeXInfo const * const xref = 0, std::string lang = "en") const;
/// replace %keys% in a format string with their values
/// called from getInfo()
/// format strings may contain:
/// \return a sorted vector of BibTeX entry types in use
std::vector<docstring> const getEntries() const;
/// \return the short form of an authorlist
- docstring const getAbbreviatedAuthor(docstring const & key) const;
+ docstring const getAbbreviatedAuthor(docstring const & key, std::string lang = "en") const;
/// \return the year from the bibtex data record for \param key
/// if \param use_modifier is true, then we will also append any
/// modifier for this entry (e.g., 1998b).
/// Note that this will get the year from the crossref if it's
/// not present in the record itself.
docstring const getYear(docstring const & key,
- bool use_modifier = false) const;
+ bool use_modifier = false, std::string lang = "en") const;
///
docstring const getCiteNumber(docstring const & key) const;
/// \return formatted BibTeX data associated with a given key.