]> git.lyx.org Git - features.git/commitdiff
Differentiate Buffer strings and GUI strings in citeengines
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 27 Jan 2018 13:26:36 +0000 (14:26 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 30 Jan 2018 07:21:21 +0000 (08:21 +0100)
The former need to be translated to the buffer language, the latter to
the GUI language.

Fixes: #10946
(cherry picked from commit 5db4d712ef660273c1c12f211fdb4adf5a792ec3)

lib/citeengines/basic.citeengine
lib/citeengines/biblatex-natbib.citeengine
lib/citeengines/biblatex.citeengine
lib/citeengines/jurabib.citeengine
lib/citeengines/natbib.citeengine
lib/layouts/stdciteformats.inc
src/BiblioInfo.cpp
src/TextClass.cpp

index a7fe12d7653d5373d899e585b7d13a4895419634..075cb1b211ca35b371a61c299e37c56da720f04d 100644 (file)
@@ -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
index edff500dbb0a2278ae73c2ec51414ad0cc595019..d994add5c0b67283ae914c6369750fa04bbcd54d 100644 (file)
@@ -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
index 96b07c6c0492310672ff5a4df7016920aafadf4e..bd101e4507c5454c5d0989e7faec044eca03f636 100644 (file)
@@ -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
index 1de398020f35cc1cca2ede1e9fa68738e494c1f4..d2faecc5a3f01b41222d1192adef0d9b13db77ad 100644 (file)
@@ -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
index 58d235f168a205af174af560412870f380cd18b5..3d93ee1ade1834a6a2584dccf15777740401de56 100644 (file)
@@ -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
index fc34cb8750dae1399467d93181d1e07ea9e18d35..a2378ce917a7d440fee5f3abda8eefc1e2b48a74 100644 (file)
@@ -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%]]}
 
index bb7c64cda2927fd2a3b72910746bffc02e055ada..f45d370ece5b432f7a781121d994b61e05cf1c13 100644 (file)
@@ -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);
index d4b7d813708b6f2ad30b2fd0b42f773db6b4de63..25965c6762ef367d3324964e449dac2aff422b00 100644 (file)
@@ -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)