BazingaJsTranslationBundle icon indicating copy to clipboard operation
BazingaJsTranslationBundle copied to clipboard

No warning if translation not found

Open pies opened this issue 7 years ago • 6 comments

Would it be possible to add callbacks such as onNotFoundInCurrentLocale and onNotFoundInFallbackLocale?

pies avatar Sep 12 '16 11:09 pies

Could you give more details about your use case?

willdurand avatar Sep 12 '16 12:09 willdurand

I'm doing translations on code that's not easy to automatically extract new keys from (TypeScript + React). I was hoping to add a console.log() in dev to indicate missing translations. Obviously not the best way to do it, but better than nothing. I can live without onNotFoundInCurrentLocale, it's easy to sync translation between different language files, so I only need a warning if a translation is missing completely.

pies avatar Sep 12 '16 18:09 pies

I should mention that I'm not using the Symfony part of this bundle (the backend app runs on Silex), only the Javascript lib. I'm not sure if it could be useful to people using the whole bundle as well.

pies avatar Sep 12 '16 18:09 pies

Hi @pies,

Thanks for the issue! In my company what we are doing is using an external translation service that handles the fallback for us.

So if the translation is not available the translation files are generated using the fallback language. Another option is for you can also load the english translations along with the other language, so you always have a fallback, using the locales parameter in BazingaJS.

For missing translations you can take a look to this url: http://symfony.com/doc/current/translation/debug.html

I don't know if this helped. Let me know if I need to be more specific.

monteiro avatar Sep 17 '16 07:09 monteiro

I haven't found any tool to automatically extract text from our JavaScript code (Typescript + React).

pies avatar Sep 18 '16 06:09 pies

Be careful, if the default translation file is not found (messages), the request is automatically redirected to the config translation file (#178).

That's why it would be very useful to get an error in this case.

Ang3 avatar Jan 17 '18 12:01 Ang3