Skip to content

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

Merged
taylorotwell merged 1 commit into
laravel:masterfrom
themsaid:plainLocalization
Nov 18, 2016
Merged

[5.4] Several modifications to the json localization approach#16470
taylorotwell merged 1 commit into
laravel:masterfrom
themsaid:plainLocalization

Conversation

@themsaid
Copy link
Copy Markdown
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
Copy Markdown
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