diff --git a/frontend/src/utils.js b/frontend/src/utils.js index 82af810..d78d354 100644 --- a/frontend/src/utils.js +++ b/frontend/src/utils.js @@ -331,6 +331,7 @@ const browserPrefersDark = () => { const mailto = (address) => window.location.href = 'mailto:' + address; // build OpenLyrics XML for given song +// see https://manual.openlp.org/display_tags.html#configuring-formatting-tags const openLyricsXML = (song, version, translatedSong = null, locales = [], allTags = null) => { const timestamp = (new Date()).toISOString().slice(0, -5); const title = `${song.title}`; @@ -345,16 +346,18 @@ const openLyricsXML = (song, version, translatedSong = null, locales = [], allTa : ''; const tags = song.tags && locales && allTags ? '' + song.tags.map( - tag => locales.map(l =>`${allTags[tag][l] ?? tag.key}`).join('') + tag => locales.map(l =>`${allTags[tag][l] ?? tag.key}`).join('') ).join('') + '' : ''; - const format = translatedSong ? `<em></em>False<span style='-webkit-text-fill-color:#c2c2a3'></span>False` : ''; + const format = translatedSong + ? `]]>]]>]]>]]>]]>]]>` + : ''; const tParts = translatedSong ? parsedContent(translatedSong.content, 0, false, false) : []; const lyrics = parsedContent(song.content, 0, false, false).map((p, i) => { const type = p.type ? p.type.toUpperCase() : 'V'; const num = p.number > 0 ? p.number : '1'; const tContent = (i in tParts) - ? `

${tParts[i].content.replace(/\n/g, "
")}
` + ? `

${tParts[i].content.replace(/\n/g, "
")}
` : ''; return `${p.content.replace(/\n/g, "
")}${tContent}
`; }).join(''); diff --git a/frontend/src/views/SetlistShow.vue b/frontend/src/views/SetlistShow.vue index fdcf6be..9158f5c 100644 --- a/frontend/src/views/SetlistShow.vue +++ b/frontend/src/views/SetlistShow.vue @@ -994,7 +994,7 @@ const exportOsz = async () => { const tParts = tSong ? parsedContent(tSong.content, 0, false, false) : []; parts.forEach((part, i) => { itemData.push({ - 'raw_slide': (i in tParts) ? part.content + "\n\n" + tParts[i].content : part.content, + 'raw_slide': (i in tParts) ? `${part.content}\n\n{it}{gr}{fd}${tParts[i].content}{/fd}{/it}{/gr}` : part.content, 'verseTag': (part.type ? part.type.toUpperCase() : 'V') + (part.number > 0 ? part.number.toString() : '1'), }); }); diff --git a/frontend/src/views/SongShow.vue b/frontend/src/views/SongShow.vue index 2beae47..31642a4 100644 --- a/frontend/src/views/SongShow.vue +++ b/frontend/src/views/SongShow.vue @@ -524,8 +524,15 @@ const exportSng = () => { }; // export song in OpenLyrics XML format const exportXml = () => { + // check for translations + const lang = !('lang' in localStorage) ? locale.value : localStorage.getItem('lang'); + let tSong = null; + if (lang !== song.value.language && song.value.translations.length > 0) { + const tKey = song.value.translations.find((t) => t.endsWith(`-${lang}`)); + tSong = props.songs[tKey]; + } // start download - download(openLyricsXML(song.value, version, null, availableLocales, props.tags), songId + '.xml'); + download(openLyricsXML(song.value, version, tSong, availableLocales, props.tags), songId + '.xml'); // toast success message notify({ title: t('toast.exportedXml'),