Instead of computing this `locales` dictionary, it looks like you can do `self.locales.indexOf(matched[1]) != -1`.