Recommended text variable format

Hi,

I would like to use text variables in a project to be localized in multiple languages. There are technical terms that have to carefully adhere to a glossary, and I would like to make this glossary once forever for each language.

So, I will have a compile format for French where ‘Quit’ is replaced with ‘Quitter’, and one for Italian where it is replaced with ‘Esci’.

But ‘Quit’ shouldn’t be an ordinary word. It must be a text variable, not to be confused with ordinary text strings. So, I must make it a text variable, with a precise format.

What can I do? I was thinking to something simple like ‘$Quit’, but will it interfere with some other reserved word?

Paolo

1 Like

I wouldn’t use a ‘$,’ since that’s what Scrivener’s placeholders use, but almost any other string would work. TVQuit, say. (For Text Variable Quit.)

3 Likes

To preserve readability, I would maybe use an underscore before the word; something like ‘_Quit’. Is this already a reserved symbol used somewhere?

Paolo

Scrivener only uses the <$...> pattern, so you’d really only have to worry about collisions using that, and can check against the placeholder list in the Help menu if so.[1]

I tend to use something with delimiters like that as well (e.g. {{word}}), as it makes regex matching safer—but for ones that I type in a lot, I’ll use !word, as that’s very unlikely to happen naturally. Underscore I would be a little concerned with if you have a lot of plain-text URLs or source code samples.


  1. Some of the non-fiction templates do have some example Replacements in their compile Formats, but they will only match on a more complex input like !fig(figure_handle), where the part in the parentheses establishes the cross-referencing handle you can use to refer to its number from elsewhere, with #fig(figure_handle). ↩︎

3 Likes

+1 on using a terminal marker, not just a starter.

I am partial to square brackets for this sort of use, and unique-r characters that don’t require Shift. (Maybe if I was a touch typist I wouldn’t care.)

Something like [.phrase.] or [-phrase-] seems to me very appealing.

2 Likes