This is a spin-off from Move editor name in biblatex bibliography, in which the editor string "edited by X" in a biblatex bibliography is replaced by "X edited" (and with the word "edited" translated in the local language".
The accepted answer extends this to cases where there's an article in a collection (@incollection entry), cf. the Weinreich 1968 entry in the MWE below.
What I would like as well, is this: When I'm citing a part of a book (with its own title and author, the @inbook entry), I'd like the authors of the book to follow the title of the book in a string "X wrote", parallel with the "X edited" case mentioned above.
For the Torp 1909 entry in the MWE below, then, I'd like it to look like this:
Torp, Alf. 1909. Gamalnorsk ordavleiding. Gamalnorsk ordbok. Med nynorsk tyding. Marius Hægstad og Alf Torp skreiv. Kristiania: Det norske samlaget (Landsmaals-laget), s. xxviii-lxxi.
How can I achieve this?
\documentclass{article}
\usepackage[backend=biber,
style = authoryear-comp,
language = nynorsk,
sortlocale = nn_NO]{biblatex}
\renewbibmacro{in:}{} % don't print "in" for any entry
\DeclareFieldFormat[article,inbook,incollection]{title}{#1} % no quotes around titles in bibliography (print as is)
\DeclareFieldFormat{editortype}{\mkbibparens{#1}} % put editor in parenthesis when before publication year
\DeclareDelimFormat{editortypedelim}{\addspace}
\usepackage{xpatch}
\xpatchbibmacro{date+extradate}{\printtext[parens]}{\setunit*{\addperiod\space}\printtext}{}{} % remove parenthesis around year in bibliography
\DefineBibliographyStrings{nynorsk}{
bibliography = {Tilvisingar},
editor = {styr\adddot},
editors = {styr\adddot},
founder = {grunnar},
founders = {grunnarar},
references = {Tilvisingar},
byauthor = {skreiv},
byeditor = {styrde},
byfounder = {grunnade},
volume = {band},
volumes = {band},
}
\renewbibmacro*{byauthor}{%
\ifboolexpr{
test \ifuseauthor
or
test {\ifnameundef{author}}
}
{}
{\printnames[byauthor]{author}%
\setunit{\addspace}%
\usebibmacro{bytypestrg}{author}{author}}}
\newbibmacro*{byeditorx:i}[1]{%
\ifnameundef{#1}
{}
{\printnames[by#1]{#1}%
\setunit{\addspace}%
\usebibmacro{bytypestrg}{#1}{editor}%
\newunit}}
\renewbibmacro*{byeditor}{%
\usebibmacro{byeditorx:i}{editor}%
\usebibmacro{byeditorx}}
\renewbibmacro*{byeditorx}{%
\usebibmacro{byeditorx:i}{editora}%
\usebibmacro{byeditorx:i}{editorb}%
\usebibmacro{byeditorx:i}{editorc}}
\renewbibmacro*{bytranslator}{%
\ifnameundef{translator}
{}
{\printnames[bytranslator]{translator}%
\setunit{\addspace}%
\bibstring{bytranslator}}}
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{\printnames[byeditor]{editor}%
\setunit{\addspace}%
\usebibmacro{byeditor+othersstrg}%
\clearname{editor}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}
\renewbibmacro*{bytranslator+others}{%
\ifnameundef{translator}
{}
{\printnames[bytranslator]{translator}%
\setunit{\addspace}%
\usebibmacro{bytranslator+othersstrg}%
\clearname{translator}%
\newunit}%
\usebibmacro{withothers}}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{flo1906,
AUTHOR = "R. Flo",
TITLE = "Midlandsmaal",
YEAR = "1906",
EDITOR = "Arne Garborg",
LOCATION = "Kristiania",
PUBLISHER = "Olaf Norlis forlag",
SUBTITLE = "Etter framlegge fraa rettskrivingsnemndi i 1899"}
@BOOK{ordbogoverdetdanskesprog,
TITLE = "Ordbog over det danske sprog",
YEAR = "1919--56",
EDITOR = "H. Juul-Jensen",
EDITORA = "Verner Dahlerup",
EDITORATYPE = "founder",
LOCATION = "K{\o}benhavn",
NOTE = "Udgivet af det danske sprog- og litteraturselskab",
PUBLISHER = "Gyldendalske boghandel. Nordisk forlag",
VOLUMES = "28"}
@INBOOK{torp1909,
AUTHOR = "Alf Torp",
BOOKTITLE = "Gamalnorsk ordbok",
TITLE = "Gamalnorsk ordavleiding",
YEAR = "1909",
BOOKAUTHOR = "Marius H{\ae}gstad and Alf Torp",
BOOKSUBTITLE = "Med nynorsk tyding",
LOCATION = "Kristiania",
PAGES = "xxviii--lxxi",
PUBLISHER = "Det norske samlaget (Landsmaals-laget)"}
@INCOLLECTION{weinreich1968,
AUTHOR = "Uriel Weinreich and William Labov and Marvin I. Herzog",
BOOKTITLE = "Directions for historical linguistics",
EDITOR = "W. P. Lehmann and Yakov Malkiel",
TITLE = "Empirical foundations for a theory of language change",
YEAR = "1968",
BOOKSUBTITLE = "A symposium",
LOCATION = "Austin, TX",
PAGES = "95--195",
PUBLISHER = "University of Texas Press"}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

