This sounds like A String in The Harp by Nancy Bond.
Here is the cover of the first edition:
You say you read it around 1995. From Wikipedia:
A String in the Harp is a children's fantasy novel by Nancy Bond first published in 1976.
It is thus certainly possible that you could have read it in 1995.
You say it is about a girl who moved to Wales. From Wikipedia:
It tells of the American Morgan family who temporarily move to Wales,
And (my emphasis):
Mr. Morgan has taken a temporary teaching position at the University of Aberystwyth and with the two younger children is living in a nearby seaside village. Jen is dismayed to find their home cold and uncomfortable, her brother and sister unhappy, and their father ignoring them. She eventually convinces her father to let her remain with the family in Wales instead of finishing high school in America.
You say it involves traveling back in time. From Wikipedia (my emphasis):
This well-received novel is an unusual time travel story, with its focus on the emotional pain and separation the Morgans experience after the death of their mother and the gradual healing they find through their experiences.
You mention aiding a king. The character list contains two kings, but the time traveling didn't really aide them in any way. From Wikipedia:
Gwyddno Garanhir, king of Ceredigion, Taliesin's patron and friend
Maelgwn Gwynedd, king of Gwynedd
This is because the time travel in this story is not really complete time travel. It's more like the characters just get to view scenes from the past. From Wikipedia (my emphasis):
As a time travel fantasy, Deborah O'Keefe in Readers in Wonderland considered A String in the Harp an unusual form of the "Junior-Year-Abroad type of fantasy" because the children observe Taliesin and his world but never fully enter it.
And a quote from Chapter Nine (my emphasis):
He could only watch: he, Peter could do nothing to prevent any of it. And it was happening again, The pattern was set by the past and could not be altered. He was only a spectator, not of that time, and therefore powerless.
You mention getting picked on and swearing and not knowing the local language. While I don't think that specifically happens in the book, it is mentioned in the beginning of the book that Peter doesn't like school, does not make friends there, and hates the fact that classes are taught in Welsh which he doesn't understand. And shortly thereafter it is mentioned that he swore, which his father would not approve of.
You mention that there may have been a hillside or a cave or something similar. There is definitely a hillside, as seen in this sentence from Chapter Seven:
They were all relieved to reach the bare, windy hillside beyond.
There was probably also at least one cave mentioned in the book.
You mention that there may have been a reference to a dragon. Here is a quote from Chapter Nine.
Not without cause had the monk Gildas called Maelgwyn "The Dragon".
And later in the same chapter:
The Dragon's attack at night had been unexpected.
There are a few discrepancies between this book and the details you mention. While there is a girl, Jen, in the book, it is mostly her brother Peter that fits the other descriptions. He was the one in school and he was the one who discovered the harp key (which is how they went back in time). Additionally, it is not the standard form of time travel (more like simply viewing the past), and I don't think there was anything significant about a box.