improve i18n middleware