Set the language of the text. Parameters ---------- language : str or None The language of the text in a format accepted by libraqm, namely `a BCP47 language code `_. If N
(self, language)
| 1570 | return self._language |
| 1571 | |
| 1572 | def set_language(self, language): |
| 1573 | """ |
| 1574 | Set the language of the text. |
| 1575 | |
| 1576 | Parameters |
| 1577 | ---------- |
| 1578 | language : str or None |
| 1579 | The language of the text in a format accepted by libraqm, namely `a BCP47 |
| 1580 | language code <https://www.w3.org/International/articles/language-tags/>`_. |
| 1581 | |
| 1582 | If None, then defaults to :rc:`text.language`. |
| 1583 | """ |
| 1584 | _api.check_isinstance((Sequence, str, None), language=language) |
| 1585 | language = mpl._val_or_rc(language, 'text.language') |
| 1586 | |
| 1587 | if not cbook.is_scalar_or_string(language): |
| 1588 | language = tuple(language) |
| 1589 | for val in language: |
| 1590 | if not isinstance(val, tuple) or len(val) != 3: |
| 1591 | raise TypeError('language must be list of tuple, not {language!r}') |
| 1592 | sublang, start, end = val |
| 1593 | if not isinstance(sublang, str): |
| 1594 | raise TypeError( |
| 1595 | 'sub-language specification must be str, not {sublang!r}') |
| 1596 | if not isinstance(start, int): |
| 1597 | raise TypeError('start location must be int, not {start!r}') |
| 1598 | if not isinstance(end, int): |
| 1599 | raise TypeError('end location must be int, not {end!r}') |
| 1600 | |
| 1601 | self._language = language |
| 1602 | self.stale = True |
| 1603 | |
| 1604 | |
| 1605 | class OffsetFrom: |
no outgoing calls