I have seen both "gostava" and "gostaria" translated to "j'aimerais" in French. Can the two be used interchangeably, or are there specific contexts where it is better to use one rather than the other?
The Imperfect and the Conditional generally have the same value only if they take modal values, for instance in conditional sentences:
Se tiveres tempo, gostava/gostaria que me levasses a jantar.
Or a polite request without a full conditional sentence:
Gostaria/Gostava que me levasses a jantar.
In these two examples, the Imperfect is more common in informal European Portuguese.
On the other hand, only the Conditional can act as future of the past:
Ontem de manhã ela encontrou-o na rua e mais tarde levá-lo-ia a jantar/*levava-o a jantar.
And only the Imperfect can describe some past events (generally with some overlapping or inclusion with another past time):
Quando era jovem, gostava/*gostaria de dormir até tarde.
(Though note that the Imperfect is not always articulated against some other point in the past — for instance, in julgava-te em Roma (I tought you were in Rome), the reference point is the present).