View Single Post
Old 01-22-2023, 03:18 PM   #7
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by enuddleyarbl View Post
Does anyone know of a reasonable way to search an english epub for French words? [...] it would be nice to span those little phrases with lang="fr".
Yes, I wrote a tutorial on this back in:

I described how to use Sigil's/Calibre's Spellcheck Lists in order to tag each Spanish/"foreign word" with an HTML language.

You could then use some regex to merge everything together.

- - -

I even wrote another tutorial showing you how you can use 2 dictionaries to quickly spot "foreign words" too:

In that case, I used the trick to quickly find all British<->American spellings.

Quote:
Originally Posted by enuddleyarbl View Post
EDIT: I should have thought of this earlier. If I'm lucky, either the publisher or Calibre will have enclosed the French stuff in italics. I'll search for <i> and, where appropriate, replace it with <i lang="fr">.
Use:

Code:
<i lang="fr" xml:lang="fr">
personally, I also add a class there too:

Code:
<i class="french" lang="fr" xml:lang="fr">
to make it easier to manipulate via CSS.

Then if you want all your French words to be red? Very simple to understand CSS:

Code:
.french {
   color: red;
}
- - -

Side Note: If you want even more on proper HTML language markup, type this into your favorite search engine:

Code:
xml:lang Tex2002ans site:mobileread.com
I've written more than 100 times about all this in ebooks!

- - -

Quote:
Originally Posted by enuddleyarbl View Post
On a quasi-related note, is there some construct to translate little blurbs of text for the reader? If these were full-fledged untranslated paragraphs of French, I'd run it through Google Translate and stick the result in a footnote. But, for these little Poirot exclamations, most of them are trivial and only some use words I don't recognize.
Leave it up to the reader/app itself. For example:
  • PocketBook

allows you to Auto-Translate text, inline, similar to Google Translate on a webpage.

You could also press+hold, then send the highlighted text to a translation site too.

(In PocketBook, you can also choose which engine you want to use, like DeepL, Google Translate, Bing Translate, etc.)

Quote:
Originally Posted by enuddleyarbl View Post
I was thinking of commandeering <abbr title="...translation...">french phrase</abbr>, but though it works in Calibre, it doesn't as a kepub on my Forma.

[...]

Right now, the best I can come up with is a full-fledged footnote to properly set the translation off from the paragraph.
If it's only for your personal usage, then you could do a footnote.

But if it's an ebook for actual sale, DO NOT use those hackish <abbr> or <ruby> methods.

If you device doesn't have the Auto-Translate stuff, you could also do something like shoving the translation right after + in a different font:

Code:
« Je parle français! » (I speak French!)
would be this HTML:

Code:
<span class="french" lang="fr" xml:lang="fr">« Je parle français! »</span> <span class="translated">(I speak French!)</span>
This would allow you to easily tweak your manually translated text, so you could do something like:

Code:
span.translated {
    font-weight: bold;
}
Quote:
Originally Posted by enuddleyarbl View Post
But, for these little Poirot exclamations, most of them are trivial and only some use words I don't recognize.
In that case, you may be able to gather from context. If not, then I just treat it like "unknown babble" or completely made-up fantasy words.

Similar to when I run across Greek or Japanese or Chinese in my books. I just nod my head... then continue reading. (But not until I properly tag the language, of course!!!)

Last edited by Tex2002ans; 01-22-2023 at 03:48 PM.
Tex2002ans is offline   Reply With Quote