"Oni diras, ke la germana estas malbela lingvo."
Translation:One says that German is an ugly language.
It's a quirk of the language. It separates the independent clause from the dependent clause.
I think the "ke" indicates that there is a sub-sentence (here: conjunction or subjuction). I'm not sure if there is a strict rule for this in Esperanto, but in some other languages you would make a little pause where the comma is. My mother tongue is German. Unlike English it uses a lot of commas and it just "feels comfortable" where it is.
Anyway, the comma before "but" is right, isn't it? This is also a conjuction.
Perhaps it is a good idea to simply remember "ke" as a signal word for a good place to use a comma.
Actually, English uses commas quite a bit but most people just don't apply them .