g-mode trapping and period spacings in hot B subdwarf stars