I wondering how to translate a URL in ZF2 that has a parameter on it.
For example:
/{:language_link-schools-:city_link}
The reason why I don't do:
/:language_link-{schools}-:city_link
It is because in some languages, for example, Spanish, the order of the words will change.
I am using PhpArray, and when I translate it, the parameters are not replaced, therefore the URL is rendered as (example in Spanish):
/:language_link-escuela-:city_link
Instead of the expected behaviour:
/ingles-escuela-miami
Edit:
The parameters are
:language_link
and :city_link
So the idea is that in one language the rendered URL could be:
/:language_link-schools-:city_link
and in another language it could be:
/:language_link-:city_link-school
Similarly as it is done when you translate a statement doing:
sprintf($this->translate('My name is %s'), $name) ;
:language_link-schools-
and:city_link
which both of them need to be translated? Not really clear as you use "_" and "-" within the same parameter? Could you show a bit more of your routing as it would be nice to see how you've set it up aswell as the the part were you're translating within an actual example. – Selfsupportingsprintf('%0$s-school-%1$s', $language_link, $city_link)
in a seperate step? – ShivareeTranslatorAwareTreeRouteStack
with "locale aware" child_routes? Or lazy-loaded routes based on the first segment? There is also: github.com/redokun/zf-linguo Would need an individual route segment:/:lang/
though. – Poison