BoltTranslate / Translate

Provides translation for contenttypes.
Other
43 stars 37 forks source link

Fix LocalizedMenuBuilder's missing reference to Lib::path #43

Closed peterverraedt closed 8 years ago

peterverraedt commented 8 years ago

Fixes LocalizedMenuBuilder's missing reference to Lib::path, by copying bolt's private function resolveRouteToLink() and referring to this function instead.

Fixes: #42

SvanteRichter commented 8 years ago

Thanks! :+1:

Just one question on that last commit, does this handler not get run on those 404's?

peterverraedt commented 8 years ago

No, it is not called, I checked. Apparently there is no (easy) way to access $this->app['request'] on 404's. This is a bit unfortunate, since I would like that the default locale (for redirecting /and 404s) is based on the Accept-Language-header of the request (but this should probably be discussed first).

SvanteRichter commented 8 years ago

Yeah, one of my plans was to use the Accept-Language header, but I hadn't gotten around to it yet... I'm guessing that the before handler only gets called when a route is matched, do you know if that is true?

Anyway, thanks again, merging in! :+1:

peterverraedt commented 8 years ago

That seems to be the case: $app->before() registers a listener for the KernelEvents::REQUEST event, which as far as I understand occurs right after matching a route.

Using the Accept-Language header should be very easy, using $this->app['request']->getPreferredLanguage($locales) in the before-function (see Symfony's api here).