Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gjøre det enklere å oversette tekst i EPUB-til-innlesing #358

Open
josteinaj opened this issue Jun 14, 2022 · 0 comments
Open

Gjøre det enklere å oversette tekst i EPUB-til-innlesing #358

josteinaj opened this issue Jun 14, 2022 · 0 comments

Comments

@josteinaj
Copy link
Member

Også oversette alle tekststrenger som mangler oversettelse.

Se hvordan f:chapter-translation er implementert i prepare-for-ebook/create-hidden-headlines.xsl, det kan sikkert gjøres på en lignende måte:

<xsl:function name="f:chapter-translation">
<xsl:param name="matter" as="xs:string"/>
<xsl:param name="section" as="element()"/>
<xsl:variable name="language" select="($section/ancestor-or-self::*/@xml:lang)[last()]" as="xs:string"/>
<xsl:variable name="language" select="if ($language = 'no') then 'nn' else $language"/> <!-- pick a language -->
<xsl:variable name="document-divisions" as="element()*">
<type name="cover">
<en>Cover</en>
<nb>Omslag</nb>
<nn>Omslag</nn>
</type>
<type name="frontmatter">
<en>Frontmatter</en>
<nb>Frontmaterie</nb>
<nn>Frontmaterie</nn>
</type>
<type name="bodymatter">
<en>Chapter</en>
<nb>Kapittel</nb>
<nn>Kapittel</nn>
</type>
<type name="backmatter">
<en>Backmatter</en>
<nb>Sluttmaterie</nb>
<nn>Sluttmaterie</nn>
</type>
<type name="part">
<en>Part</en>
<nb>Del</nb>
<nn>Del</nn>
</type>
</xsl:variable>
<xsl:variable name="document-sections" as="element()*">
<class name="frontcover">
<en>Front cover</en>
<nb>Forside</nb>
<nn>Framside</nn>
</class>
<class name="rearcover">
<en>Back cover</en>
<nb>Bakside</nb>
<nn>Bakside</nn>
</class>
<class name="leftflap">
<en>Left flap</en>
<nb>Venstre innbrett</nb>
<nn>Venstre innbrett</nn>
</class>
<class name="rightflap">
<en>Right flap</en>
<nb>Høyre innbrett</nb>
<nn>Høgre innbrett</nn>
</class>
<type name="volume">
<en>Volume</en>
<nb>Bind</nb>
<nn>Bind</nn>
</type>
<type name="part">
<en>Part</en>
<nb>Del</nb>
<nn>Del</nn>
</type>
<type name="chapter">
<en>Chapter</en>
<nb>Kapittel</nb>
<nn>Kapittel</nn>
</type>
<type name="subchapter">
<en>Subchapter</en>
<nb>Underkapittel</nb>
<nn>Underkapittel</nn>
</type>
<type name="division">
<en>Division</en>
<nb>Del</nb>
<nn>Del</nn>
</type>
<type name="z3998:section">
<en>Section</en>
<nb/>
<nn/>
</type>
<type name="z3998:subsection">
<en>Subsection</en>
<nb/>
<nn/>
</type>
<type name="abstract">
<en>Abstract</en>
<nb>Sammendrag</nb>
<nn>Samandrag</nn>
</type>
<type name="foreword">
<en>Foreword</en>
<nb>Forord</nb>
<nn>Forord</nn>
</type>
<type name="preface">
<en>Preface</en>
<nb>Innledning</nb>
<nn>Innleiing</nn>
</type>
<type name="prologue">
<en>Prologue</en>
<nb>Prolog</nb>
<nn>Prolog</nn>
</type>
<type name="introduction">
<en>Introduction</en>
<nb>Innledning</nb>
<nn>Innleiing</nn>
</type>
<type name="preamble">
<en>Preamble</en>
<nb>Innledning</nb>
<nn>Innleiing</nn>
</type>
<type name="conclusion">
<en>Conclusion</en>
<nb/>
<nn>Avslutning/Konklusjon</nn>
</type>
<type name="epilogue">
<en>Epilogue</en>
<nb>Epilog</nb>
<nn>Epilog</nn>
</type>
<type name="afterword">
<en>Afterword</en>
<nb>Etterord </nb>
<nn>Etterord</nn>
</type>
<type name="epigraph">
<en>Epigraph</en>
<nb>Innskrift</nb>
<nn>Innskrift</nn>
</type>
<type name="toc">
<en>Table of contents</en>
<nb>Innhold</nb>
<nn>Innhald</nn>
</type>
<type name="toc-brief">
<en>Abridged table of contents</en>
<nb>Forkortet innholdsfortegnelse</nb>
<nn>Kort innhaldsfortegnelse</nn>
</type>
<type name="landmarks">
<en>Landmarks</en>
<nb/>
<nn/>
</type>
<type name="loa">
<en>List of audio clips</en>
<nb>Lydklipp</nb>
<nn>Lydklipp</nn>
</type>
<type name="loi">
<en>List of illustrations</en>
<nb>Illustrasjoner</nb>
<nn>Illustrasjonar</nn>
</type>
<type name="lot">
<en>List of tables</en>
<nb>Tabeller</nb>
<nn>Tabellar</nn>
</type>
<type name="lov">
<en>List of video clips</en>
<nb>Videoer</nb>
<nn>Videoar</nn>
</type>
<type name="appendix">
<en>Appendix</en>
<nb>Vedlegg</nb>
<nn>Vedlegg</nn>
</type>
<type name="colophon">
<en>Colophon</en>
<nb>Kolofon</nb>
<nn>Kolofon</nn>
</type>
<type name="credits">
<en>Credits</en>
<nb>Bidragsytere</nb>
<nn>Bidragsytere</nn>
</type>
<type name="keywords">
<en>Keywords</en>
<nb>Søkeord</nb>
<nn>Søkjeord</nn>
</type>
<type name="z3998:discography">
<en>Discography</en>
<nb/>
<nn/>
</type>
<type name="z3998:filmography">
<en>Filmography</en>
<nb/>
<nn/>
</type>
<type name="index">
<en>Index</en>
<nb>Innhold</nb>
<nn>Innhald</nn>
</type>
<type name="index-headnotes">
<en>Headnotes</en>
<nb>Innhold</nb>
<nn>Innhald</nn>
</type>
<type name="index-legend">
<en>Legend</en>
<nb>Symbolfolklaring</nb>
<nn>Symbolfolklaring</nn>
</type>
<type name="index-group">
<en>Group</en>
<nb/>
<nn/>
</type>
<type name="glossary">
<en>Glossary</en>
<nb>Ordliste</nb>
<nn>Ordliste</nn>
</type>
<type name="dictionary">
<en>Dictionary</en>
<nb>Ordliste</nb>
<nn>Ordliste</nn>
</type>
<type name="bibliography">
<en>Bibliography</en>
<nb>Bibliografi</nb>
<nn>Bibliografi</nn>
</type>
<type name="titlepage">
<en>Title page</en>
<nb>Tittelside</nb>
<nn>Tittelside</nn>
</type>
<type name="halftitlepage">
<en>Half title page</en>
<nb>Tittel</nb>
<nn>Tittel</nn>
</type>
<type name="copyright-page">
<en>Copyright page</en>
<nb>Opphavsrett</nb>
<nn>Opphavsrett</nn>
</type>
<type name="seriespage">
<en>Series page</en>
<nb>Andre bøker i serien</nb>
<nn>Andre bøker i serien</nn>
</type>
<type name="acknowledgments">
<en>Acknowledgments</en>
<nb>Takk til:</nb>
<nn>Takk til:</nn>
</type>
<type name="imprint">
<en>Imprint</en>
<nb>Imprint</nb>
<nn>Imprint</nn>
</type>
<type name="imprimatur">
<en>Imprimatur</en>
<nb>Imprimatur</nb>
<nn>Imprimatur</nn>
</type>
<type name="contributors">
<en>Contributors</en>
<nb>Bidragsytere</nb>
<nn>Bidragsytere</nn>
</type>
<type name="other-credits">
<en>Other credits</en>
<nb>Andre bidragsytere</nb>
<nn>Andre bidragsytere</nn>
</type>
<type name="errata">
<en>Errata</en>
<nb/>
<nn/>
</type>
<type name="dedication">
<en>Dedication</en>
<nb>Dedikasjon</nb>
<nn>Dedikasjon</nn>
</type>
<type name="revision-history">
<en>Revision history</en>
<nb>Revidert</nb>
<nn>Revidert</nn>
</type>
<type name="z3998:published-works">
<en>Published works</en>
<nb>Tidlegere utgitt</nb>
<nn>Tidlegare utgivingar</nn>
</type>
<type name="z3998:publisher-address">
<en>Publisher address</en>
<nb>Adresse</nb>
<nn>Adresse</nn>
</type>
<type name="z3998:editorial-note">
<en>Editorial note</en>
<nb/>
<nn/>
</type>
<type name="z3998:grant-acknowledgment">
<en>Grant acknowledgment</en>
<nb/>
<nn/>
</type>
<type name="z3998:biographical-note">
<en>Biographical note</en>
<nb>Biblografi</nb>
<nn>Biblografi</nn>
</type>
<type name="z3998:translator-note">
<en>Translator note</en>
<nb>Oversetterns kommentar</nb>
<nn>Omsetjarens kommentar</nn>
</type>
<type name="z3998:promotional-copy">
<en>Promotional copy</en>
<nb/>
<nn/>
</type>
<type name="case-study">
<en>Case study</en>
<nb>Eksempelstudie</nb>
<nn>Eksempelstudie</nn>
</type>
<type name="notice">
<en>Notice</en>
<nb>Notis</nb>
<nn>Anførsel</nn>
</type>
<type name="answers">
<en>Answers</en>
<nb>Svar</nb>
<nn>Svar</nn>
</type>
<type name="assessment">
<en>Assessment</en>
<nb>Vurdering</nb>
<nn>Vurdering</nn>
</type>
<type name="assessments">
<en>Assessments</en>
<nb>Vurderinger</nb>
<nn>Vurderingar</nn>
</type>
<type name="qna">
<en>Questions and answers</en>
<nb>Spørsmål og svar</nb>
<nn>Spørsmål og svar</nn>
</type>
<type name="practices">
<en>Practices</en>
<nb>Øvinger</nb>
<nn>Øvingar</nn>
</type>
<type name="footnotes">
<en>Footnotes</en>
<nb>Noter</nb>
<nn>Noter</nn>
</type>
<type name="rearnotes">
<en>Rearnotes</en>
<nb>Noter</nb>
<nn>Noter</nn>
</type>
<type name="endnotes">
<en>Endnotes</en>
<nb>Noteapparat</nb>
<nn>Noteapparat</nn>
</type>
<type name="page-list">
<en>Page list</en>
<nb/>
<nn/>
</type>
<type name="z3998:poem">
<en>Poem</en>
<nb>Dikt</nb>
<nn>Dikt</nn>
</type>
</xsl:variable>
<xsl:variable name="section-title" select="$document-sections[local-name() = 'type' and @name = f:types($section)][1]/*[local-name() = $language]/text()" as="xs:string?"/>
<xsl:variable name="section-title" select="if ($section-title) then $section-title else $document-sections[local-name() = 'class' and @name = f:classes($section)][1]/*[local-name() = $language]/text()" as="xs:string?"/>
<xsl:variable name="division-title" select="(
$document-divisions[@name = $matter]/*[local-name() = $language]/text(),
$document-divisions[@name = $matter]/*:nn/text(),
$document-divisions[@name = 'bodymatter']/*[local-name() = $language]/text(),
$document-divisions[@name = 'bodymatter']/*:nn/text()
)[1]" as="xs:string?"/>
<xsl:value-of select="if ($section-title) then $section-title else if ($division-title) then $division-title else ''"/>
</xsl:function>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant