Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fallback value if translation is null #214

Closed
sod opened this issue Aug 28, 2017 · 1 comment
Closed

Use fallback value if translation is null #214

sod opened this issue Aug 28, 2017 · 1 comment

Comments

@sod
Copy link

sod commented Aug 28, 2017

Symfony and Bazinga fallback implementation seems to differ.

So given yaml:

--- # messages.en.yml
foo: bar
--- # messages.fr.yml
foo: ~

Given locale_fallback = 'en', locale = 'fr' and domain = 'messages':

  • php/twig {{ 'foo'|trans }} outputs string: bar
  • bazinga Translate.trans('foo') outputs null

Could it be possible to drop all null values by the dumper?

@Timmypedia
Copy link

I found a workaround for this issue.
Try this:
<script src="{{ url('bazinga_jstranslation_js',{"locales":app.request.locale~",en"}) }}"></script>
Its seems that the Bundle prefer the "non-fallback" locale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants