Next: , Previous: , Up: Customization   [Contents][Index]


2.4.10 Using multiple languages

You can use speechd-el with multiple languages. However, the process can’t be easily automated, since ordinary text does not contain any information about its language. So if you want to use speechd-el with the output being spoken in multiple languages, you must provide speechd-el some hints.

The language settings described below currently apply only to the spoken output, to select the proper voice. They don’t affect the Braille output; but you may want to set language coding for Braille, See Connection Setup.

The basic means for providing language information to speechd-el is the variable speechd-language. Each time speechd-el is about to speak a piece of text, it checks the variable for the language code and if it is non-nil, it speaks the text in the corresponding language. The non-nil value must be a string of the RFC 1766 language code (e.g. en, cs, etc.).

Most often you will probably want to set the variable in a particular file, see File Variables in GNU Emacs Manual, or as a buffer local variable, see Locals in GNU Emacs Manual, in mode hooks, see Hooks in GNU Emacs Manual.

If a piece of the text has the language property containing the RFC 1766 language code, it is spoken in the corresponding language, regardless of other settings. You can use the speechd-language function to put the property on a string in your Elisp programs.

Another good way of using multiple languages is to use multiple connections for separating language dependent buffers or modes, see Multiple Connections, and to set the language parameter for each such a connection, see Connection Voices.

If nothing helps better, you can select languages according to the current input method:

speechd-speak-input-method-languages

Alist mapping input methods to languages. Each of the alist elements is of the form (input-method-name . language), where input-method-name is a string naming the input method and language is an RFC 1766 language code accepted by SSIP (e.g. en, cs, etc.). If the current input method is present in the alist, the corresponding language is selected unless overridden by another setting.

Some texts in Emacs, such as messages, minibuffer prompts or completions, are typically in English. speechd-el reads them in English by default, but it can be instructed to use another language for them:

speechd-speak-emacs-language

Language to use for texts originating from Emacs. It’s a string containing an RFC 1766 language code accepted by SSIP, en by default. It can be also nil, meaning the language should be unchanged and the current language should be used.


Next: , Previous: , Up: Customization   [Contents][Index]