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.
How it works
Section titled “How it works”- Every phrase an application can say is listed in a translation file in gettext PO format: the English text and an empty translation.
- Phrases with variable parts contain substitution tags; a language module turns numbers, durations and dates into the words of the language.
- A voice talent records every phrase and every word the language module uses. The recordings form the prompt set of the language.
- Once installed, the language can be selected under Type & Languages of an application and as an account’s IVR language.
For the translator
Section titled “For the translator”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
Language rules
Section titled “Language rules”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.
For the developer
Section titled “For the developer”- 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 withcompilepo.sh <code>. - 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, implementsayNumber(),sayDigits(),sayDuration()andsayDatetime(), 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. - Record every phrase and word as 8 kHz signed linear audio and place them in the prompt directory of the language; the
prompt_utils.pyhelper checks the set for missing prompts. - Send the PO file, the module and the prompt set to support for installation.