6

I have a Mountain Lion macbook and it's default locale is english, it's keyboard is english (US) as well. I need to change the language that the terminal replies to Swedish.

For example, Instead of replying "Connection Refused" for a failed telnet, it should say "Forbindelse Vagras" (which is the Swedish translation)

EDIT: I have tried setting LANG=sv_SE.UTF-8 and same with LC_ALL, to no effect

Have also tried changing system-wide settings, which changes the language in the entire system but not the zsh shell.

Is this split localization possible on macOS?

5
  • I don't think command-line tools like telnet are localized. Commented Nov 6, 2013 at 8:34
  • so i'll have to get extra language packs?
    – user2959177
    Commented Nov 7, 2013 at 11:35
  • 1
    I don't think there are any extra language packs :) Everything is already shipped with OS X; these tools simply were never localized. The only command-line tool that ships some locale info is /usr/bin/cal; if you type LANG=sv_SE cal in Terminal you will get weekday names in Swedish. That's as far as you get. Commented Nov 7, 2013 at 11:55
  • Bah! Any ideas about other OSs? Windows, Ubuntu... I can install a VM and test what I need to.
    – user2959177
    Commented Nov 8, 2013 at 13:02
  • 1
    Windows is definitely the best at this, all standard components should be perfectly localized, but it's command-line environment is not POSIX and lacking features to the degree of pathetic. Try also FreeBSD, RedHat/Fedora (you may need to install additional packages having "nls" in their name). Commented Nov 8, 2013 at 13:43

2 Answers 2

1

In the terminal enter

export LANG=sv_SE.UTF-8

You can add that to ~/.bashrc (or ~/.zshrc for zsh) in order to change the language for all terminal sessions.

All command line tools that are localized should now print the output in Swedish.

However, those command line tools that were built without localization but use hard-coded texts cannot be changed in any way (except on source code level, of course), your example telnet being one of them.

4
  • This is the correct thing to do but as the comments show this does not solve the OP's issue. Most POSIX command are hard coded to report in English
    – mmmmmm
    Commented Jun 24, 2022 at 11:37
  • You're right. I've added a note to my answer.
    – not2savvy
    Commented Jun 24, 2022 at 11:59
  • Virtualization is clearly what OP needs here since they can’t change the entire macOS locale. Forgive any typos in my edit.
    – bmike
    Commented Jun 24, 2022 at 12:03
  • 1
    @bmike I don't think your edit is correct. If tools are built with hard-coded English texts, virtualization makes no difference whatsoever. My macOS is set to German, and some command line tools still print their output in English.
    – not2savvy
    Commented Jun 24, 2022 at 12:12
0

I imagine you'll want to set the LANG environment variable.

1
  • 1
    tried that... it shows LANG="sv_SE.UTF-8" LC_COLLATE="sv_SE.UTF-8" LC_CTYPE="sv_SE.UTF-8" LC_MESSAGES="sv_SE.UTF-8" LC_MONETARY="sv_SE.UTF-8" LC_NUMERIC="sv_SE.UTF-8" LC_TIME="sv_SE.UTF-8" LC_ALL="sv_SE.UTF-8" but the language remains stubbornly english
    – user2959177
    Commented Nov 6, 2013 at 7:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .