I wonder if the easy way to do this is to remove all strings from CSL
files, define a list of variables, and allow them to be implemented
natively in software? That way the files are mostly simplified, and
remain self-contained. Doing that, I could also move the prefix and
suffix elements back to attributes, since they don’t have to carry any
formatting information. Files become more compact, and any possible
future OO code is simpler (prefix and suffix become simple attributes
of an object, rather than full objects).
So thinking not in XML, but rather YAML, it could be as simple as this:
en:
in: In
and: and
accessed: accessed
date-accessed: date accessed
presented-at: presented at
editor-single-full: Editor
editor-multiple-full: Editors
editor-single-short: Ed
editor-multiple-short: Eds
edited-by: Edited By
translator-single-full: Translator
translator-multiple-full: Translators
translator-single-short: Tran
translator-multiple-short: Trans
translated-by: Translated By
The style file would then just be responsible for selecting the right
variables; something like:
I hadn’t done this earlier because I thought it wasn’t possible, but
maybe I’m wrong.
The software would then know which specific variable to grab depending
on, for example, the role and whether there is one or more. In code:
def print_role(role, type, form, single)
case role
when "editor"
if type == "noun" and form == "short" and single == true then
puts @@strings["en"]["editor-short"]
end
end
end
Not the best code, but you get the idea.
Would that work?
Bruce