How to write in Brazilian Portuguese using a US keyboard?

5,831

When you use the English (US, international with dead keys) layout, the ' (apostrophe) key is turned to a 'dead' key. To type an accent character by itself, you can press ' twice, which results in ´ (acute accent), or you can press ' followed by Space, which results in ' (apostrophe).

Edit:

If you prefer the basic English (US) layout without dead keys, the below may be a suitable setup for GTK applications:

  1. Enable a compose key: How can I enable Compose key?

  2. Create the file ~/.XCompose and give it this contents:

    <Multi_key> <apostrophe> <C> : "Ç" Ccedilla # LATIN CAPITAL LETTER C WITH CEDILLA
    <Multi_key> <apostrophe> <c> : "ç" ccedilla # LATIN SMALL LETTER C WITH CEDILLA
    

Then you can easily type the most common accented letters, for instance:

Compose followed by ' followed by A => á

Compose followed by ' followed by C => ç

and at the same time:

' followed by S => 's

Edit II:

As David pointed out in a comment, the compose key has a built-in way to type ccedilla:

Compose followed by , (comma) followed by C => ç

So basically the ~/.XCompose file suggested above is redundant.

Share:
5,831

Related videos on Youtube

Gustavo Sousa
Author by

Gustavo Sousa

Updated on September 18, 2022

Comments

  • Gustavo Sousa
    Gustavo Sousa over 1 year

    I've used Linux and FreeBSD as my main desktop environments from 2000 to 2006. Back then we would have to edit keyboard maps to make Portuguese Brazilian work. Since then, I stopped using Linux as desktop and moved to MacOS because it was very time consuming to just get things done.

    I've been hearing about all the evolution of the Linux desktop in the last decade and a couple of weeks ago I just bought a new Dell XPS preloaded with Ubuntu 16.04 and what a surprise... I just can't get my keyboard to work correctly!

    At first I couldn't get it to write the cedilla "ç" using US-international. By following the instructions in How to type latin small letter c with cedilla I could get it to work, but now all consonants get "accented" (.e.g., '+s becomes ś or '+r becomes ŕ), which is just not possible in Portuguese. The expected behavior would be 's or 'r.

    Why is it so difficult to just get things right?

    I would like to know if is there any solution or workaround to this problem.

    EDIT: Someone marked this as duplicate of another question on how to use multiple languages. This is not the issue here. My question is how to make Ubuntu/Linux correctly work to write Brazilian Portuguese using a US keyboard.

    In other words, typing ' followed by s should output 's and not ś, meanwhile typing ' followed by a should output á and typing ' followed by c should output ç.

    So, the question is how do I get this behavior?

    EDIT: As I got no real answer I coded a small ibus input method, based on ibus-tmpl for solving this. Probably not a good solution, but the quickest workaround I could find. It is available on http://github.com/gcms/ibus-semidead

    • wjandrea
      wjandrea about 6 years
      Why don't you use a Portugese keyboard layout?
    • wjandrea
      wjandrea about 6 years
      I speak French myself. If I'm going to be writing just a few words, I'll use the US layout with Compose key for accented characters, but if I'll be writing paragraphs, I'll switch to the Canadian French layout.
    • pomsky
      pomsky about 6 years
      "typing ' followed by s should output 's and not ś,...": read the answer I linked carefully. You need to press <space> after the apostrophe key (') in order use in as apostrophe instead of accent. So ' + s = ś, ' + space + s = 's. Also right alt + , = ç (take a look at the keyboad layout).
    • Gustavo Sousa
      Gustavo Sousa about 6 years
      Why do I have to be pressing spaces all around? Why can't I just make it work as it works in MacOS or Windows ans as it has always worked in all systems sold in Brazil with US keyboards since the 90s? Why do I have to change my typing habits and reduce my productivity? I would like to know how to configure it o work correctly and not to learn a suboptimal solution.
    • Gustavo Sousa
      Gustavo Sousa about 6 years
      It is not Windows nor Mac but it is supposed to be a user friendly distro. And as open source and Linux-based I assume it should be customizable. Just telling me to type differently is not a answer to the question. The question is how to configure Ubuntu to use US keyboard and achieve the desired behavior.
    • Gunnar Hjalmarsson
      Gunnar Hjalmarsson about 6 years
      It sounds like English (US, international with dead keys) is not what you want. Did you understand @wjandrea's hint about a compose key? That would give you most accented characters, but not ccedilla. To handle the latter a custom keyboard layout is one possibility.
    • pomsky
      pomsky about 6 years
      My last comment here as I feel nothing fruitful is going to come out of this discussion any more: if "the desired behavior" is replicating some feature from another OS in Ubuntu, then it may not always be possible (same goes the other way around). (I'm not claiming it's impossible in this particular issue)
    • Gustavo Sousa
      Gustavo Sousa about 6 years
      @pomsky I kind of understand your point, but the desired behavior here is not replicating some feature from another OS, this is just the natural behavior that is expected from users that have been using US keyboards for decades. It is like if I removed backspace from your keyboard and just told you to live with Delete because we're not replicating features from other OS. This is not a feature from a particular OS, this is just how things have always been for end-user systems.
    • Gunnar Hjalmarsson
      Gunnar Hjalmarsson about 6 years
      My impression is that most Brazilian Linux users with English keyboards use some English layout with dead keys, and that their main concern is how to type ç conveniently. Anyway, I just edited my answer with an alternative with English (US), which explains what @wjandrea mentioned above and points to a way to type ç.
    • quixotic
      quixotic about 6 years
      you might look into the nativo-us variants of the br or pt layouts in XKB. nativo is apparently dvorak-based and designed for portuguese. the olpc variant of br layout may also be suitable for your needs. these variants are defined in /usr/share/X11/xkb/symbols/br and .../pt.
    • Gustavo Sousa
      Gustavo Sousa about 6 years
      @quixotic I've been typing on a US keyboard for over 15 years. It just doesn't make sense to change now. BTW, I also write in 3 other languages that use the same symbols. Changing between layouts for each language is just non-sense.
    • Gustavo Sousa
      Gustavo Sousa about 6 years
      As I got no real answer I coded a small ibus input method, based on ibus-tmpl for solving this. Probably not a good solution, but the quickest workaround I could find. It is available on github.com/gcms/ibus-semidead
  • Gustavo Sousa
    Gustavo Sousa about 6 years
    I know this, but this is not the desired behavior nor natural for Portuguese writers. Thatś why I am asking for a solution that works correctly. Why is it that it works smoothly in Windows and MacOS but not in Linux? There must be a solution to this problem.
  • David Foerster
    David Foerster about 6 years
    The default US keyboard layout already allows the cedilla (ç, Ç) through the compose sequence , (comma), c and ,, Shift+c.
  • Gunnar Hjalmarsson
    Gunnar Hjalmarsson about 6 years
    @DavidFoerster: You are right. I kind of forgot that in my attempt to come as close to the OP's specification as possible. But indeed, that way makes probably the ~/XCompose file redundant.