I'm from Germany and in German both translate to the same word (kaum). I'd like to know the difference between these two words, hardly and barely.
They are not always interchangeable.
That's American English. I don't know about other varieties.
Each has meanings that are different from those of the other, but I assume you are referring to cases in which the two seem interchangeable. The relevant definitions in the Oxford English Dictionary suggest that they are:
Because of their other meanings, a corpus search is not entirely reliable. However, the Corpus of Contemporary American English shows the two words as being almost equally as frequent as each other, whereas the British National Corpus shows a strong preference for hardly. A more detailed search might establish whether one is used in a different kind of context from the other, as can sometimes be the case with such pairs.
I don't have a whole lot to base this on, but to use an example given by another poster:
It seems to me that they are completely different here. If the ticket sales barely cover the expenses, they cover them, but only by a little (e.g., expenses = $100, ticket sales = $101) If the ticket sales hardly cover the expenses, they don't cover them, possibly by a large amount.
Similarly, hardly working means not working, but barely working means working, but only a little.
The differences are usually very subtle and in most cases even the distinctions that I make below would seldom be thought worth commenting on if the "wrong" word was used, if the usage was even noticed.
In some only cases -
'Barely' tends to convey a sense of magnitude of final achievement. ie the actual limit or magnitude is the primary focus.
'Hardly' tends to convey a sense of just adequate performance to cause a limit to be reached. ie the focus shifts subtly towards the reason for the limit only just being exceeded.
But, in many cases, they are so close to interchangeable as to be uncertain which if either, is to be preferred.
One example where there is a large bias, which is probably caused by the expression in question being effectively a 'catch phrase' or 'figure of speech' is 'barely/hardly the same'. Here 'Barely' implies that the two could be said to be 'the same' but only if the comparison was casually made. Whereas, "hardly the same" is entrenched in English with a meaning of something like "NOT the same when you consider aspects that are important when when they may appear to be the same on a quick inspection".
Barely old enough to drive. (Perhaps b' v.slightly preferred)
'Barely fast enough' - just exceeded the minimum speed limit. Speed the foucs.
'Hardly fast enough' same, but perhaps a hint that the inadequacies of the vehicle that lead to it being slow were more at issue than the speed itself.
"The ticket sales barely/hardly cover the expenses" - either could be used but there is a different "feel" to them.
"Had barely got under cover when the rain/shells/Martians began to fall." Here barely is more likely to be used. Hardly would go unnoticed but be less common.
Barely / hardly enough food.
Barely/hardly enough money
This one surprised me - both with the historical relative merit and the recent crossover.
Hardly is describing the effort required. Hardly = 'it was hard to do.'
Barely is describing the appearance, or impression, of how well it is being done. Barely = 'hasn't really got it covered. It is a bit bare.'
In the real world, you could probably get along well enough by taking the easy option of 'they are the same' - plenty of native speakers do!
Hardly often appears as an euphemism for Not. Especially in binary context, where the answer can be yes or no, a "hardly yes" answer means simply "no" or "very unlikely".
Imagine there's a competition that will take some time to calculate the score. "He hardly won this competition" means all signs point to "He lost" - we will know for sure only when the score is published, but he performed so clearly worse that it would take some miracle.
It also bears a somewhat different emotional load. The small size of the difference is something non-standard, and often disappointing.
"I made it, though barely!" is what you'd say after a hard race, satisfied by a marginal victory. "I was hardly better than the opponent" would be said if you barely won against an opponent who was much worse, and you're disappointed in your own performance. "It's hardly cheaper, considering the extra costs" you'd say skeptical about buying about a car with worse gas mileage, but "It's barely 1mpg worse than the other one!" would be a positive expression where the difference being so small is not a negative.
Also, there are some differences in where and how one or the other is used:
[though I can't quite pinpoint how that works]