In Portuguese, when we use a verb that asks for both direct and indirect object (and they’re pointed out specifically, i.e. we’re aware of what/who they are), we can contract these two pronouns by adding the third person direct pronouns to the indirect object. Sounds complicated, we know. Let’s see a practical example:
Dei uma prenda à Joana. I gave Joana a gift.
In this sentence, neither the direct object (uma prenda) nor the indirect object (à Joana) have been replaced by a clitic.
Dei-lhe uma prenda. I gave her a gift.
In this sentence, the indirect object (à Joana) has been replaced by the clitic –lhe, while the direct object remains in place.
Dei-lha. I gave it to her.
Finally, both objects have been replaced by clitics – “a prenda” was replaced by the clitic –a and “à Joana” was replaced by the clitic -lhe. The two were merged, with –a placed at the end of –lhe to form –lha.
This merger only works when the direct object is in the third person. If the direct object is in the first or second persons, it’s not possible to merge the two.
The table below shows how to make these mergers.
These mergers are not usually done with –lhes. When -lhes is replacing your indirect object, we maintain the direct object in place after it. Example:
Nós demos-lhes um computador. We gave them a computer.