B.C. judge apologizes for foul-mouthed language