JMSI18nRoutingBundle icon indicating copy to clipboard operation
JMSI18nRoutingBundle copied to clipboard

How to translate Requirements ?

Open acrozes opened this issue 12 years ago • 3 comments

Hi,

Example:

@Route("/{channel}/", requirements={"channel"="channel_fr_1|channel_fr_2|channel_fr_3"}, name="channel_home")

I'd like to set:

  • en: requirements={"channel"="channel_en_1|channel_en_2|channel_en_3"}
  • de: requirements={"channel"="channel_de_1|channel_de_2|channel_de_3"}

Maybe we can add in route.en.xml :

channel_home /{channel}/ [...] channel_home.requirements channel_en_1|channel_en_2|channel_en_3

acrozes avatar Jan 11 '13 22:01 acrozes

I'd not enumerate the available channels in the requirements. You probably have them stored in the database anyway, no?

schmittjoh avatar Jan 13 '13 17:01 schmittjoh

Personally: After this route, I have an other one for generic case: @Route("/{q}/", name="query") I think it is better to have 2 routes ... so presently I have for the channel_home route : requirements={"channel"="channel_en_1|channel_en_2|channel_en_3|channel_de_1|channel_de_2|channel_de_3|channel_fr_1|channel_fr_2|channel_fr_3"} but it is not the best ... Enumeration is speeder ...

For everybody: I think some requirements should be translatable ...

acrozes avatar Jan 13 '13 20:01 acrozes

I am having this extract issue right now in current project :-/

jperovic avatar Apr 22 '13 01:04 jperovic