### 4.32 `towctrans`, `towctrans_l`—extensible wide-character translation ¶

Synopsis

    #include <wctype.h>
    wint_t towctrans(wint_t c, wctrans_t w);

    #include <wctype.h>
    wint_t towctrans_l(wint_t c, wctrans_t w, locale_t locale);

Description
`towctrans` is a function which converts wide characters based on a specified translation type w. If the translation type is invalid or cannot be applied to the current character, no change to the character is made.

`towctrans_l` is like `towctrans` but performs the function based on the locale specified by the locale object locale. If locale is LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.

Returns
`towctrans`, `towctrans_l` return the translated equivalent of c when it is a valid for the given translation, otherwise, it returns the input character. When the translation type is invalid, `errno` is set to `EINVAL`.

Portability
`towctrans` is C99. `towctrans_l` is POSIX-1.2008.

No supporting OS subroutines are required.