Anahkiasen / polyglot

Laravel localization and translation helper
130 stars 22 forks source link

A few updates #54

Closed DMeganoski closed 7 years ago

DMeganoski commented 7 years ago

Well, first I should say that I've been using this package in a laravel 4.2 application in heavy production for over a year and it's worked out great for me.

With a bit of tweaking, I managed to get this, waavi/translation, and barryvdh/laravel-translation-manager working together for rather painless translation management.

The application that I'm working on now doesn't need translated just yet, though I have need for a list of countries, and I already have built a pretty complete one (with translated names) for the other application and decided to import it rather than try to rebuild it with just one language.

Soo... I needed polyglot to handle the name translation, or to implement my own relations. Thus, here I am.

There were actually only a few issues I ran into trying to implement this in Laravel 5.3.

First, your last commit, where you fixed the paths in the service provider... you only need to do that in the register function. When it is called again in the boot method, it adds the __DIR__ variable again, and the path is already absolute. It caused an error trying to publish the config, is all.

Secondly, it seems they added a new parameter to the Lang::get() function, in this commit

This causes an error to be thrown if php is in strict mode. Other than that it seems to be working fine.

If you could update those two things, it would be much appreciated. Also, you should include 'en' in the config's locales array by default, since it is the default locale anyways. the empty array had me thinking the package still wasn't working for longer than I'd like to admit.

Also, the documentation could use updating, since you don't extend the Polyglot class, but use it as a trait, now. :)

DMeganoski commented 7 years ago

Just found another issue trying to update the records. PolyglotObserver.php has 2 functions which require the model to be an instance of Polyglot, still. Since the Polyglot class is now a trait and not an extension of a model, I would change to requirement to Illuminate\Database\Eloquent\Model.

Anahkiasen commented 7 years ago

@DMeganoski I actually don't have much time for open source currently and the only time I have I try to focus on Rocketeer :/ But I see you're interested in the project, and maybe others are as well, do you want me to add you as collaborator so you can contribute directly to the project in the meantime, so you're not stuck?

DMeganoski commented 7 years ago

I can completely understand that. Sure, that would be appreciated. Working on fixing the unit tests atm.