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