mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-21 17:51:03 +00:00
Differentiate Buffer strings and GUI strings in citeengines
The former need to be translated to the buffer language, the latter to
the GUI language.
Fixes: #10946
(cherry picked from commit 5db4d712ef
)
This commit is contained in:
parent
48f1b52004
commit
275d5d30de
@ -45,7 +45,8 @@ CiteFormat default
|
||||
#
|
||||
# MACROS
|
||||
#
|
||||
# 1. Translatable bits (need to be marked by _ prefix)
|
||||
# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
|
||||
# or B_, if translated to the buffer language)
|
||||
# Note that preceding and trailing spaces matter.
|
||||
#
|
||||
_notcited not cited
|
||||
|
@ -131,14 +131,15 @@ CiteFormat default
|
||||
#
|
||||
# MACROS
|
||||
#
|
||||
# 1. Translatable bits (need to be marked by _ prefix)
|
||||
# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
|
||||
# or B_, if translated to the buffer language)
|
||||
# Note that preceding and trailing spaces matter.
|
||||
#
|
||||
_notcited not cited
|
||||
_addtobib Add to bibliography only.
|
||||
_keyonly Key only.
|
||||
_key Key
|
||||
_finaland , and
|
||||
B_finaland , and
|
||||
_footnote Footnote
|
||||
_foot Foot
|
||||
_fullcite bibliography entry
|
||||
@ -149,10 +150,10 @@ CiteFormat default
|
||||
_citetitlestar F&orce full title[[Possible substitute to All aut&hors]]
|
||||
_citetitlestartooltip Use full title even if shorttitle exists
|
||||
# The following are handled by BiblioInfo
|
||||
_etal et al.
|
||||
_namesep , [[separate author names in citation, except for last name]]
|
||||
_lastnamesep , and [[separate name of last author in citation]]
|
||||
_pairnamesep and [[separate two authors in citation]]
|
||||
B_etal et al.
|
||||
B_namesep , [[separate author names in citation, except for last name]]
|
||||
B_lastnamesep , and [[separate name of last author in citation]]
|
||||
B_pairnamesep and [[separate two authors in citation]]
|
||||
|
||||
#
|
||||
# 2. Macros re-used in the style definitions
|
||||
@ -171,7 +172,7 @@ CiteFormat default
|
||||
!endlink {!</a>!}
|
||||
|
||||
# Add " , and " before the last item (but " and " if there are only two), else ", "
|
||||
!smartsep {%second%[[{%next%[[%_namesep%]][[%_pairnamesep%]]}]][[{%next%[[%_namesep%]][[%_lastnamesep%]]}]]}
|
||||
!smartsep {%second%[[{%next%[[%B_namesep%]][[%B_pairnamesep%]]}]][[{%next%[[%B_namesep%]][[%B_lastnamesep%]]}]]}
|
||||
|
||||
# "Author et al." or "??"
|
||||
!abbrvciteauthor {%abbrvciteauthor%[[%abbrvciteauthor%]][[??]]}
|
||||
@ -294,7 +295,8 @@ CiteFormat numerical
|
||||
#
|
||||
# MACROS
|
||||
#
|
||||
# 1. Translatable bits (need to be marked by _ prefix)
|
||||
# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
|
||||
# or B_, if translated to the buffer language)
|
||||
#
|
||||
_super Super
|
||||
_superscript Superscript
|
||||
|
@ -122,7 +122,8 @@ CiteFormat default
|
||||
#
|
||||
# MACROS
|
||||
#
|
||||
# 1. Translatable bits (need to be marked by _ prefix)
|
||||
# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
|
||||
# or B_, if translated to the buffer language)
|
||||
# Note that preceding and trailing spaces matter.
|
||||
#
|
||||
_notcited not cited
|
||||
@ -141,10 +142,10 @@ CiteFormat default
|
||||
_citetitlestar F&orce full title[[Possible substitute to All aut&hors]]
|
||||
_citetitlestartooltip Use full title even if shorttitle exists
|
||||
# The following are handled by BiblioInfo
|
||||
_etal et al.
|
||||
_namesep , [[separate author names in citation, except for last name]]
|
||||
_lastnamesep , and [[separate name of last author in citation]]
|
||||
_pairnamesep and [[separate two authors in citation]]
|
||||
B_etal et al.
|
||||
B_namesep , [[separate author names in citation, except for last name]]
|
||||
B_lastnamesep , and [[separate name of last author in citation]]
|
||||
B_pairnamesep and [[separate two authors in citation]]
|
||||
|
||||
#
|
||||
# 2. Macros re-used in the style definitions
|
||||
@ -155,7 +156,7 @@ CiteFormat default
|
||||
!endlink {!</a>!}
|
||||
|
||||
# Add " , and " before the last item (but " and " if there are only two), else ", "
|
||||
!smartsep {%second%[[{%next%[[%_namesep%]][[%_pairnamesep%]]}]][[{%next%[[%_namesep%]][[%_lastnamesep%]]}]]}
|
||||
!smartsep {%second%[[{%next%[[%B_namesep%]][[%B_pairnamesep%]]}]][[{%next%[[%B_namesep%]][[%B_lastnamesep%]]}]]}
|
||||
|
||||
# A dummy year modifier. This just indicates that a modifier might be output,
|
||||
# to differentiate \cite* and \citeyear
|
||||
@ -278,7 +279,8 @@ CiteFormat numerical
|
||||
#
|
||||
# MACROS
|
||||
#
|
||||
# 1. Translatable bits (need to be marked by _ prefix)
|
||||
# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
|
||||
# or B_, if translated to the buffer language)
|
||||
#
|
||||
_super Super
|
||||
_superscript Superscript
|
||||
|
@ -114,7 +114,8 @@ CiteFormat authoryear
|
||||
#
|
||||
# MACROS
|
||||
#
|
||||
# 1. Translatable bits (need to be marked by _ prefix)
|
||||
# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
|
||||
# or B_, if translated to the buffer language)
|
||||
# Note that preceding and trailing spaces matter.
|
||||
#
|
||||
_notcited not cited
|
||||
@ -126,10 +127,10 @@ CiteFormat authoryear
|
||||
_before before
|
||||
_shorttitle short title
|
||||
# The following are handled by BiblioInfo
|
||||
_etal et al.
|
||||
_namesep /
|
||||
_lastnamesep /
|
||||
_pairnamesep /
|
||||
B_etal et al.
|
||||
B_namesep /
|
||||
B_lastnamesep /
|
||||
B_pairnamesep /
|
||||
|
||||
#
|
||||
# 2. Macros re-used in the style definitions
|
||||
|
@ -112,7 +112,8 @@ CiteFormat default
|
||||
#
|
||||
# MACROS
|
||||
#
|
||||
# 1. Translatable bits (need to be marked by _ prefix)
|
||||
# 1. Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
|
||||
# or B_, if translated to the buffer language)
|
||||
# Note that preceding and trailing spaces matter.
|
||||
#
|
||||
_notcited not cited
|
||||
@ -120,10 +121,10 @@ CiteFormat default
|
||||
_keyonly Key only.
|
||||
_key Key
|
||||
# The following are handled by BiblioInfo
|
||||
_etal et al.
|
||||
_namesep , [[separate author names in citation, except for last name]]
|
||||
_lastnamesep , and [[separate name of last author in citation]]
|
||||
_pairnamesep and [[separate two authors in citation]]
|
||||
B_etal et al.
|
||||
B_namesep , [[separate author names in citation, except for last name]]
|
||||
B_lastnamesep , and [[separate name of last author in citation]]
|
||||
B_pairnamesep and [[separate two authors in citation]]
|
||||
|
||||
#
|
||||
# 2. Macros re-used in the style definitions
|
||||
|
@ -15,18 +15,20 @@ Format 66
|
||||
|
||||
CiteFormat default
|
||||
#
|
||||
# Translatable bits
|
||||
# Translatable bits (need to be marked by _ prefix, if translated to the GUI language,
|
||||
# or B_, if translated to the buffer language)
|
||||
# Note that preceding and trailing spaces matter.
|
||||
#
|
||||
_pptext pp.
|
||||
_edtext ed.
|
||||
_edstext eds.
|
||||
_voltext vol.
|
||||
_numtext no.
|
||||
_in in
|
||||
B_pptext pp.
|
||||
B_edtext ed.
|
||||
B_edstext eds.
|
||||
B_voltext vol.
|
||||
B_numtext no.
|
||||
B_in in
|
||||
# The following are handled by BiblioInfo. Note that preceding and trailing spaces matter
|
||||
_namesep , [[separate author names in citation, except for last name]]
|
||||
_lastnamesep , and [[separate name of last author in citation]]
|
||||
_pairnamesep and [[separate two authors in citation]]
|
||||
B_namesep , [[separate author names in citation, except for last name]]
|
||||
B_lastnamesep , and [[separate name of last author in citation]]
|
||||
B_pairnamesep and [[separate two authors in citation]]
|
||||
|
||||
#
|
||||
# Macros
|
||||
@ -42,13 +44,13 @@ CiteFormat default
|
||||
# Scheme of authors in citation references
|
||||
!citenameform {%prefix%[[%prefix% ]]}%surname%
|
||||
# pagination
|
||||
!pages {%pages%[[, %_pptext% %pages%]]}
|
||||
!pages {%pages%[[, %B_pptext% %pages%]]}
|
||||
# ed. or eds.
|
||||
!makeed {%ifmultiple:editor%[[%_edstext%]][[%_edtext%]]}
|
||||
!makeed {%ifmultiple:editor%[[%B_edstext%]][[%B_edtext%]]}
|
||||
# author or editor, as fullnames, following the schemes above
|
||||
!authoredit {%fullnames:author%[[%fullnames:author%, ]][[{%fullnames:editor%[[%fullnames:editor%, %!makeed%, ]]}]]}
|
||||
# "vol. 1, no.
|
||||
!volnum {%volume%[[ %_voltext% %volume%, {%number%[[%_numtext% %number%]]}]]}
|
||||
!volnum {%volume%[[ %B_voltext% %volume%, {%number%[[%B_numtext% %number%]]}]]}
|
||||
!quotetitle "%title%"
|
||||
!emphtitle {!<i>!}%title%{!</i>!}
|
||||
!emphjournal {!<i>!}{%journal%[[%journal%]][[{%journaltitle%[[%journaltitle%]]}]]}{!</i>!}
|
||||
@ -57,7 +59,7 @@ CiteFormat default
|
||||
#
|
||||
# Entry types. Note that final punctuation will be added later, if needed.
|
||||
#
|
||||
!insomething %fullnames:author%, %!quotetitle%, %_in%{%fullbynames:editor%[[ %fullbynames:editor%, %!makeed%,]]} {!<i>!}%booktitle%{!</i>!}%!volnum%{%edition%[[ %edition%]]} (%!location%%publisher%, %year%)%!pages%{%note%[[. %note%]]}
|
||||
!insomething %fullnames:author%, %!quotetitle%, %B_in%{%fullbynames:editor%[[ %fullbynames:editor%, %!makeed%,]]} {!<i>!}%booktitle%{!</i>!}%!volnum%{%edition%[[ %edition%]]} (%!location%%publisher%, %year%)%!pages%{%note%[[. %note%]]}
|
||||
|
||||
article %fullnames:author%, %!quotetitle%, %!emphjournal% {%volume%[[ %volume%{%number%[[, %number%]]}]]} (%year%)%!pages%{%note%[[. %note%]]}
|
||||
|
||||
|
@ -541,16 +541,16 @@ docstring const BibTeXInfo::getAuthorList(Buffer const * buf,
|
||||
|
||||
// These are defined in the styles
|
||||
string const etal =
|
||||
buf ? buf->params().documentClass().getCiteMacro(engine_type, "_etal")
|
||||
buf ? buf->params().documentClass().getCiteMacro(engine_type, "B_etal")
|
||||
: " et al.";
|
||||
string const namesep =
|
||||
buf ? buf->params().documentClass().getCiteMacro(engine_type, "_namesep")
|
||||
buf ? buf->params().documentClass().getCiteMacro(engine_type, "B_namesep")
|
||||
: ", ";
|
||||
string const lastnamesep =
|
||||
buf ? buf->params().documentClass().getCiteMacro(engine_type, "_lastnamesep")
|
||||
buf ? buf->params().documentClass().getCiteMacro(engine_type, "B_lastnamesep")
|
||||
: ", and ";
|
||||
string const pairnamesep =
|
||||
buf ? buf->params().documentClass().getCiteMacro(engine_type, "_pairnamesep")
|
||||
buf ? buf->params().documentClass().getCiteMacro(engine_type, "B_pairnamesep")
|
||||
: " and ";
|
||||
string firstnameform =
|
||||
buf ? buf->params().documentClass().getCiteMacro(engine_type, "!firstnameform")
|
||||
@ -811,13 +811,20 @@ docstring BibTeXInfo::expandFormat(docstring const & format,
|
||||
fmt = from_utf8(val) + fmt.substr(1);
|
||||
counter += 1;
|
||||
continue;
|
||||
} else if (key[0] == '_') {
|
||||
// a translatable bit
|
||||
} else if (prefixIs(key, "B_")) {
|
||||
// a translatable bit (to the Buffer language)
|
||||
string const val =
|
||||
buf.params().documentClass().getCiteMacro(engine_type, key);
|
||||
docstring const trans =
|
||||
translateIfPossible(from_utf8(val), buf.params().language->code());
|
||||
ret << trans;
|
||||
} else if (key[0] == '_') {
|
||||
// a translatable bit (to the GUI language)
|
||||
string const val =
|
||||
buf.params().documentClass().getCiteMacro(engine_type, key);
|
||||
docstring const trans =
|
||||
translateIfPossible(from_utf8(val));
|
||||
ret << trans;
|
||||
} else {
|
||||
docstring const val =
|
||||
getValueForKey(key, buf, ci, xrefs, max_keysize);
|
||||
|
@ -1179,7 +1179,7 @@ bool TextClass::readCiteFormat(Lexer & lexrc)
|
||||
char initchar = etype[0];
|
||||
if (initchar == '#')
|
||||
continue;
|
||||
if (initchar == '!' || initchar == '_') {
|
||||
if (initchar == '!' || initchar == '_' || prefixIs(etype, "B_")) {
|
||||
if (type & ENGINE_TYPE_AUTHORYEAR)
|
||||
cite_macros_[ENGINE_TYPE_AUTHORYEAR][etype] = definition;
|
||||
if (type & ENGINE_TYPE_NUMERICAL)
|
||||
|
Loading…
Reference in New Issue
Block a user