[FrameworkBundle][Translator] Validate locales.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT
btw, this getLocale implementation can also return `null` which is not allowed according to the interface as well.