mac locales

Tomasz Pala gotar at polanet.pl
Tue Jul 12 08:41:45 CEST 2016


On Tue, Jul 12, 2016 at 08:20:02 +0200, Tomasz Pala wrote:

>> b) update /etc/profile.d/lang.sh to change "UTF-8" -> "C.UTF-8" when 
>> inheriting env from ssh session
> 
> Just put it in your OSX.

OK, maybe some more explanation here - there are many cases when
ssh-inherited locales might be invalid. Think about using some new ones
or having stripped on a server, like I do have sometimes, e.g. my local
machine:

$  locale -a | wc -l
20

if you want to handle that, you need entire logic, to:

1. choose encoding - this is not only about UTF-8, sometimes it's ISO vs
KOI or something even more complicated (consider zh_CN),

2. falls back to proper language, not necessarily C - you got them in
$LANGUAGES.

2a. if you do not have LANGUAGES, use system-wide default language
(/etc/sysconfig/i18n) UNLESS encoding mismatches - if so, decide what to
do:
- fallback to default_lang.UTF-8 (if that one exists of course!),
- fallback to C.UTF-8.

2b. remember, that systemd-way system locale is defined in /etc/locale.conf.

That could be done, sure. But it's not the right place to be - this code
is executed for EVERY LOGIN SHELL. I do not want some OSX hacks carried
to every -shell I spawn. if you got a problem on server-side, fix it on
your server instance, if you got a problem on client-side, fix it there.

Or create rc-scripts-smart_locale subpackage with the code that do the
magic. It could even do some GeoIP lookups to choose default language,
as long as it's optional.

-- 
Tomasz Pala <gotar at pld-linux.org>


More information about the pld-devel-en mailing list