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

[5.4] Several modifications to the json localization approach #16470

Merged
merged 1 commit into from
Nov 18, 2016
Merged

[5.4] Several modifications to the json localization approach #16470

merged 1 commit into from
Nov 18, 2016

Conversation

themsaid
Copy link
Member

@themsaid themsaid commented Nov 18, 2016

Added support for keyed replacements:

__('Hello :name, you have :unread messages.', ['name' => 'David', 'unread' => 123])

And also the method now preserves key order between different locales, for example:

// In en/*.php
['to :name I give :greeting' => ':greeting :name']
__("to :name I give :greeting", ['David', 'Greetings'])

This will print Greetings David when the locale is en, and to David I give Greetings if the locale is yoda.

@taylorotwell taylorotwell merged commit 08ef110 into laravel:master Nov 18, 2016
@taylorotwell
Copy link
Member

I just got rid of makeJsonReplacements and used makeReplacements instead. This means you have to pass keys, which I think is honestly a pretty good habit and makeReplacements also handles some capitalization stuff.

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.

2 participants