In most base utilities which support NLS, translation catalogs are tied to specific encodings (for example, ee has catalog for ru_RU.KOI8-R, but not ru_RU.UTF-8). To not duplicate catalogs for different encodings, implement a mechanism which allows encoding conversion during the build. This works as follows:
- New locales are added to NLS as usual
- For each such locale, it's source file should be defined via NLSSRCDIR_${locale} or NLSSRCFILE_${locale} (as usual), and the source locale name should be defined in NLSICONV_${localename}. Thus, if NLSICONV_${localename} is defined, iconv is called to convert the character set. Encodings are take from source and destination locale names.
To demonstrate and use new mechanism, add ru_RU.UTF-8 nls support for ee. Confirmed to work on recent current: with LC_ALL=ru_RU.UTF-8 ee shows localized interface.
Another solution would be to convert all catalogs to UTF-8 by default and call iconv automatically based on locale name. That'll make NLSICONV_${localename} unneeded, but is more intrusive.
Question for reviewers: is it safe to use verbatim iconv in bsd.nls.mk?