schmittjoh / JMSI18nRoutingBundle

Allows you to internationalize your routing
http://jmsyst.com/bundles/JMSI18nRoutingBundle
358 stars 159 forks source link

Make sure to add hreflang on localized pages. #164

Open Nyholm opened 9 years ago

Nyholm commented 9 years ago

This introduces a twig function hreflang that will print <link rel="alternate" hreflang="es" href="http://es.example.com/" /> on all pages that are localized.

I do also remove calls to deprecated functions.

stof commented 9 years ago

replacing deprecated calls should be sent in a separate PR rather than being mixed with a new feature. Replacing deprecated calls probably requires less discussions than a new feature, and mixing both makes it harder to review the new feature

acasademont commented 8 years ago

Hi @Nyholm as @stof suggested would be better to only have a PR with the new feature. Can you rebase with master?

Nyholm commented 8 years ago

Thank you @acasademont for taking time to review this. I have now rebased the code.

What do you think about using the twig environment instead of injecting the RequestStack?

XWB commented 8 years ago

@Nyholm You need to fix the tests as well.

Nyholm commented 8 years ago

I've updated this PR. It supports SF2.3 and the tests are fixed. @acasademont, is this ready to be merged?

XWB commented 8 years ago

@Nyholm Have you also checked the i18n_locales routing option? Imagine the following setup:

jms_i18n_routing:
    locales: [nl, en, fr]
not_french:
    path: /not-french
    options: { i18n_locales: [nl, en] }

This should ignore the fr locale and only generate <link rel="alternate" hreflang="nl" href="http://nl.example.com/" /> and `<link rel="alternate" hreflang="en" href="http://en.example.com/" />.

XWB commented 8 years ago

You also need to add twig to composer.json.

Nyholm commented 8 years ago

Thank you @XWB for your feedback. I had not considered the scenario where you do not use all locales.

I have rewritten the PR according to your comments.

picks44 commented 7 years ago

Hi @Nyholm @stof @XWB, how can we use this function? I see nothing in the doc... Also, is there a possibility to get all locale used in the config? SO we can use this in a controller to create a language switcher for instance, without having to duplicate all language entries...

picks44 commented 7 years ago

Up ?