Can 間 replace とき in the the following sentence?「口の中に食べ物があるときにしゃべってはいけません」


> 口の中に食べ物があるときにしゃべってはいけません
>
> Book translation: you should not talk while you have food in your mouth

If I were to replace とき with 間, then the meaning would practically remain the
same: as I see it, the difference between both is that the former suggests an
instant of time while the latter a period of time.




V1 あいだに V2 has a little tricky connotation. It either implies the subject of
V2 deliberately times the action, or V1 causes a lacuna of attention, or
negligence that allows V2 to take place.

> 寝ている間に家に忍び込む (← take advantage of sleeping hours)  
>  見ない間に大きくなった (← grown up while they haven't noticed)

So, 口の中に食べ物があるあいだにしゃべる sound as if somebody tries to speak while eating
because, say, an evil curse only allows them to speak while eating.

You can still use あいだ correctly in following constructions:

> 口の中に食べ物があるあいだ、しゃべってはいけません  
>  口の中に食べ物があるあいだはしゃべってはいけません

But these tend to sound like an objective, technical instruction that tries to
define the start and end of "no-speak period" (backed by e.g. infection
prevention purpose). So usually what you hear for the English meaning is the
original Japanese.

