symfony-bundle
symfony-bundle copied to clipboard
Profiler: Fallback locale in missing translations
When having country specific translations there are locales like de_CH and fr_FR. In my opinion the "Missing" tab in the profiler should only offer the possibility to translate the non country specific versions de and fr by default.
If the current locale setting is de_CH and there wasn't a fallback to de available (then it would be in the "Fallback" tab) a new created translation should always be de (if de is also in the supported locales) - this is also the symfony default behaviour.
I think the same should be in AutoAddMissingTranslations. There it could be very easy. Just substr the locale in Translation\Bundle\EventListener\AutoAddMissingTranslations.
The tabs are all from Symfony. They are using the Symfony translation data collector.
But isn't this a feature? You can have all "normal" translations in de and if there are some that are country specific you add then in de_CH and de_AU. That would keep de_CH and de_AU small and de is the large one. That would reduce the number of strings you translate, right? Or am I missing something?
@Nyholm That's actually what we do. We do have all our translations in de but only a few in de_CH.
But in the "Missing" tab are only translations which do not have a Fallback to de (country unspecific).

Those two translations in the screenshot are not available in de but the translation will be added as de_CH anyway. I am sure that using the country unspecific locale might be the only thing what's needed (in the "Missing" tab).
@Nyholm we have the same problem. The AutoAddMissingTranslations will always create messages in the most specific way. If you use fallback-logic, this is a rare case. It seem's not easy how to determine if it should created de or de_CH as @toooni pointed out, if there a fallback-catalogue, it normally makes sence to write into it.
Interesting. I'll have a look