In a large skillet cook the onion and the celery in the butter over moderately low heat, stirring, until the vegetables are softened, stir in the brown sugar, the garlic, and the apples, and cook the mixture, stirring, until the sugar is dissolved. Add the sauerkraut, the thyme and salt to taste, stir the stuffing until it is combined well, and let it stand, covered and chilled, overnight to develop the flavors. Bring the stuffing to room temperature before stuffing the turkey.
The stuffing can also be baked separately. Spoon the stuffing into a shallow baking dish and bake it, covered, in a preheated 325 degree oven for 1 hour and 30 minutes.