Skip to content

Conversation

@xAockd
Copy link
Contributor

@xAockd xAockd commented May 13, 2014

For getting nested messages.

Example: Lang.get('foo.bar.baz.bat')

For getting nested messages.

Example: Lang.get('foo.bar.baz.bat')
@rmariuzzo
Copy link
Owner

Thanks @xAockd for your collaboration, I will create proper unit tests for this.

One question, how do you store nested messages in Laravel. I want to have better picture of this.

@rmariuzzo rmariuzzo self-assigned this May 13, 2014
@xAockd
Copy link
Contributor Author

xAockd commented May 14, 2014

@rmariuzzo

Messages stored by native way...

Like:

directory -> lang\en\general

return array(
    "family" => array(
            "father" => "John",
            "mother" => "Susan",
            "children"  => array(
                 "son" => "Jimmy",
                  ....
            )
      )
);

So, for getting name of son, we write


Lang.get('general.family.children.son')

@rmariuzzo
Copy link
Owner

Great! I will update it in a while. Thanks!

rmariuzzo added a commit that referenced this pull request May 14, 2014
@rmariuzzo rmariuzzo merged commit aac2a27 into rmariuzzo:develop May 14, 2014
@rmariuzzo
Copy link
Owner

Hey @xAockd! I have run the tests with your proposed changes and I got some failures, I will apply some fixes to make it work as expected.

If you are curious, you may run the test by typing: npm test.

Currently I'm getting the following output:

17 tests, 21 assertions, 8 failures, 0 skipped

@rmariuzzo
Copy link
Owner

@xAockd I have added a new release: 319da36 supporting nested messages.

@xAockd
Copy link
Contributor Author

xAockd commented May 15, 2014

Thx @rmariuzzo 👍
Happy coding :)

rmariuzzo pushed a commit that referenced this pull request Mar 6, 2017
Update LaravelJsLocalizationServiceProvider.php
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