Skip to content

[6.x] Fix for empty fallback_locale - #34136

Merged
taylorotwell merged 1 commit into
laravel:6.xfrom
ahmedsayedabdelsalam:6.x
Sep 4, 2020
Merged

[6.x] Fix for empty fallback_locale#34136
taylorotwell merged 1 commit into
laravel:6.xfrom
ahmedsayedabdelsalam:6.x

Conversation

@ahmedsayedabdelsalam

Copy link
Copy Markdown
Contributor

// ar
'foo' => ''
// en
'foo', => 'bar'

before
trans('file.foo',[],'ar') // ''

after
trans('file.foo',[],'ar') // 'bar'

#34128

@GrahamCampbell GrahamCampbell changed the title fallback to fallback_locale translation when empty string [6.x] Fix for empty fallback_locale Sep 4, 2020
@taylorotwell
taylorotwell merged commit 02e983e into laravel:6.x Sep 4, 2020
@ahmedsayedabdelsalam

Copy link
Copy Markdown
Contributor Author

I tried to update laravel version but I think this fix is not released yet.

@driesvints

Copy link
Copy Markdown
Member

@ahmedsayedabdelsalam releases are done on Tuesdays.

@ahmedsayedabdelsalam

Copy link
Copy Markdown
Contributor Author

Great! Thanks.

driesvints referenced this pull request in illuminate/translation Sep 9, 2020
driesvints added a commit that referenced this pull request Sep 9, 2020
taylorotwell pushed a commit that referenced this pull request Sep 9, 2020
@driesvints

Copy link
Copy Markdown
Member

We've reverted this as this was a breaking change.

@ahmedsayedabdelsalam

Copy link
Copy Markdown
Contributor Author

Is there any plan to fix that or this is not an issue?

@driesvints

Copy link
Copy Markdown
Member

This was the expected behavior and it's unlikely that we'll ever change this.

@ahmedsayedabdelsalam

ahmedsayedabdelsalam commented Sep 9, 2020

Copy link
Copy Markdown
Contributor Author

Hmmm. Most of Excel Sheet Translation packages pull the not translated languages as an empty string value and I think it's logic because the data type for translations is designed to be strings

For me I'll fix it in my project but I suggest making a config key determines when the translator should fallback if an empty strings or null.

Like: 'fallback_when_empty' => true, // translations.php config file

Anyway thanks for your time.

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

Successfully merging this pull request may close these issues.

3 participants