Skip to content

Add an IVR language

The IVR applications speak every language whose prompt set and speech rules are installed on the switch. A new language needs three things: the phrases translated, the rules for saying numbers, durations and dates in that language, and the recordings. This page is for the translator and the developer who prepare them; the result is installed by support.

  1. Every phrase an application can say is listed in a translation file in gettext PO format: the English text and an empty translation.
  2. Phrases with variable parts contain substitution tags; a language module turns numbers, durations and dates into the words of the language.
  3. A voice talent records every phrase and every word the language module uses. The recordings form the prompt set of the language.
  4. Once installed, the language can be selected under Type & Languages of an application and as an account’s IVR language.

You receive a PO file; edit it with a PO editor such as Poedit. Translate every phrase and keep every substitution tag; you may move a tag within the sentence.

Tag Replaced with
%n A number
%[H]n An ordinal: “first”, “twenty third”
%[D]n Digits one by one: 1234 → “one two three four”
%d A duration
%D A date and time
%s A text

Names in parentheses, as in %(number)n or %(duration)d, are internal variable names: never translate them. For example "You have %(number)n new messages" becomes in Ukrainian "У вас %(number)n нових повідомлень".

The phrase "For English press %n" is special: translate it as “For press %n” in your language, since it is the entry of your language in the language menu.

The language module needs these rules, with the words each rule uses:

Rule What to describe English example
Numbers How numbers are composed, including cases and genders 12345 → “twelve thousand three hundred forty five”; words one to nineteen, the tens, hundred, thousand, million, minus
Ordinals Ordinal forms “first”, “second”, “twenty seventh”
Digit sequences Special readings “one oh two” for 102, “double oh” for 00
Durations Units with all plural forms “one hour twenty four minutes and thirty seconds”
Dates and times Order, months, weekdays, relative days “October twenty first, two fifty five PM”; “today”, “yesterday”, “tomorrow”

Languages without plural forms need one form per word; languages with several plural forms need all of them.

  1. Create the language’s PO file from the phrase template of the IVR service with its mergepo.sh <code> helper, hand it to the translator, and compile the result with compilepo.sh <code>.
  2. Write the language module, named by the two-letter code in upper case, for example UK.py, in the IVR service’s text synthesis directory. Base it on an existing module, implement sayNumber(), sayDigits(), sayDuration() and sayDatetime(), wrap every word in _phrase_noop(), declare the encoding on the second line, and register the module in the package’s __init__.py. The module must not call the synthesiser itself.
  3. Record every phrase and word as 8 kHz signed linear audio and place them in the prompt directory of the language; the prompt_utils.py helper checks the set for missing prompts.
  4. Send the PO file, the module and the prompt set to support for installation.