Dialog files, substitution tokens, and automatic pluralization

Inside of a skill handler, I find myself wanting to use a little tuple-index trick as a ternary operator as a ternary operator trick, to be a “plurality” detector/handler. E.g.,

self.speak(str(inquiry.total) + " issue" + (’’, ‘s’)[inquiry.total > 1] + " remain unresolved.")
thissue = self.jira.issue(inquiry[0].key, fields=‘summary,comment’)
self.speak("Highest priority unresolved issue is regarding: " + thissue.fields.summary)

This way, if there is only 1 result, no ‘s’ follows, but if more than one, the ‘s’ is inserted (I extracted example this out of an if-then block that handles zero-results case, but you could imagine an extension to this tuple expression that would handle zero as well).

But as far as I can tell, this will prevent me from using dialog files. Is there some built-in mechanism in the dialog file tokens that would give me a similar capability? Or another special function that would somehow provide “auto-pluralization”? Or is there a different approach that somegives me the best of both worlds?

Good question for @forslund or @Mn0491

The dialog files uses the standard(ish) python formating method to render data, you could do a dialog file like so:

{{inquiry_total}} issue{{plural}} remain unresolved

Then in your python file

        data = {'inqiury_total': inquiry.total,
                    'plural': 's' if inquiry.total > 1 else ''}
        self.speak_dialog('file', data)

From the top of my head so syntax errors may exist