When my lad was home on R&R recently, I took him to his grandparents (who live in Spain) for a rest. During the flight, I had to ask him to please not swear in front of them because my father, in particular, would go ballistic. At the same time, I apologised to my parents in advance if he inadvertently slipped up.
He behaved himself very well although we were only there for 4 days.
I can understand how difficult it must be because the swearing is virtually part of the military language.
There's a part Richard Holmes' "Dusty Warriors", and I wish I had it here so that I could quote it, where he describes two different types of languages that those in the forces use, when at work and when at home. He puts it really well.