\useMPlibrary[dum]

\setupinteraction
    [state=start,
     style=,
     color=,
     contrastcolor=,
     openaction=FitWindow]

\placebookmarks[chapter,section]

%\enablemode[en]
\enablemode[nl]

\enablemode[l2]
\enablemode[l4]

\starttext

\completecontent

%TOC works correctly but the PDF bookmarks text is not correct
\startchapter[ 
    title={\doifmode{en}{English Chapter Title}\doifmode{nl}{Dutch Chapter Title}}, 
    bookmarks{\doifmode{en}{English Chapter Title}\doifmode{nl}{Dutch Chapter Title}}] 

\startmodeset
[en] {
    \startsection[title={English section title}]
    Generic English text.

    \startmodeset
        [l2] {
            This is English L2 text.}
        [l4] {
            This is English L4 text.}
    \stopmodeset
    \stopsection
}
    % Place a figure inbetween two modeset cases does not work
    %\startplacefigure[title={
    %   \doifmode{en}{English caption}
    %   \doifmode{nl}{Dutch caption}}]
    %  \externalfigure[dummy][width=0.4\textwidth]
    %\stopplacefigure
[nl] {
    \startsection[title={Dutch Section Title}]
    Generic Dutch text.
    
    % No space between the L2 and L4 sentences, expected
	\startmodeset
		[l2] {This is Dutch L2 text.}
		[l4] {This is Dutch L4 text.}
	\stopmodeset
	
    % One space between L2 and L4 sentences, expected
    \startmodeset
		[l2] {This is Dutch L2 text.
        }
		[l4] {This is Dutch L4 text.
        }
	\stopmodeset
	
    % Two spaces between the L2 and L4 sentences, not expected !
    \startmodeset
		[l2] {
            This is Dutch L2 text.
        }
		[l4] {
            This is Dutch L4 text.
        }
	\stopmodeset
    \stopsection
}
\stopmodeset
\stopsection

\stopchapter

\stoptext



