I'm Brazilian but when I installed Debian on my machine I set the language to English (US). I prefer to keep my menus and error messages in English because they are more googable (and the translations aren't always the best...). Anyway, this had the unfortunate consequence of making it annoying to write text in Portuguese because in the en_US locale (with a "US international with dead keys" keyboard layout) typing '+c results in a Ć instead of the Ç that I want. Is there a way to make my "typing locale" be PT_BR while still keeping all my menus in English and the US keyboard layout with dead keys?


The way to change the dead keys without changing the keyboard layout is to set the LC_CTYPE environment variable to pt_BR.utf8. I did this by adding the following line to my .profile.

export LC_CTYPE='pt_BR.utf8'

There are also other LC_ variables that you can set if you want. The locale command shows a list of them, this page describes what they do and locale -a says what locales are currently available in the system.

That said, in order for this to work, both the en_US.utf8 and pt_BR.utf8 locales need to be installed in the system. To make sure this is the case, run

sudo dpkg-reconfigure locales

In the first screen, it will ask what locales you want to generate for the system (so select both en_US.utf8 and pt_BR.utf8) and in the second screen it asks what should be the default system language (choose English).

  • Setting LC_CTYPE doesn't affect the keyboard layout. – Gilles 'SO- stop being evil' Dec 24 '14 at 20:03
  • @Gilles: Why is setting LC_CTYPE is working for me then? The ç works when I set that variable to "pt_BR.utf8" and goes back to being ć when I set it to "en_US.utf8". And if I run locale, everything is set to english except LC_CTYPE – hugomg Dec 24 '14 at 20:30
  • Oh, did you mean that you want to retain the US keyboard layout, and only change the dead key compositions? I didn't understand that from your question. In this case, your answer is mostly right, except that setting LANG and LANGUAGE is not necessary and has the nasty side effect of setting LC_COLLATE. Just set LC_CTYPE to pt_BR.utf8 in ~/.profile or ~/.pam_environment. – Gilles 'SO- stop being evil' Dec 24 '14 at 20:38
  • OK. In my case the assignments to LANG and LANGUAGE are redundant so I guess its a good idea to leave them out. But that link you gave is confusing me. Right now, all my environment variables are set to en_US.utf8 - should they have been C instead? (Is this what choosing "none" as the language in dpkg-reconfigure does? Does this make my menus appear in english?) – hugomg Dec 24 '14 at 20:47
  • C is the default locale and in practice that means English and ASCII. Since you want English with Unicode, leave most locale variables unset (this is equivalent to setting them to C), and set LC_CTYPE (the utf8 part is the most important; the part of LC_CTYPE before the . only affects a few programs, one of which is the input method you're using where it affects dead keys). – Gilles 'SO- stop being evil' Dec 24 '14 at 20:52

You can do it:

dpkg-reconfigure locales
  • What does this command do? I don't want to change everything, just how my keyboard input is treated... – hugomg Dec 24 '14 at 0:40
  • You can copy/paste from here, It reconfigure locales package, when you reconfiure it, you can add or remove other locales and "set your default locale", you need to set default locale. – PersianGulf Dec 24 '14 at 0:44
  • but if I change my default locale to pt_BR its also going to make all my menus appear in Portuguese isn't it? I don't want that. – hugomg Dec 24 '14 at 1:13
  • No, when you change your locale change everything, But you can have keyboard layout and some other.... – PersianGulf Dec 24 '14 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.