WordPress.org

Ready to get started?Download WordPress

Forums

Multisite Language Switcher
[resolved] Two simple questions (15 posts)

  1. Willem-Siebe
    Member
    Posted 1 year ago #

    Hi,

    1) Does your switcher add the hreflang tags?

    I need this setup (all the links need to be on every page in the multisite setup):

    hreflang=”nl_NL” href=”http://domainname.net”
    hreflang=”nl_BE” href=”http://domainname.be”
    hreflang=”fr_BE” href=”http://fr.domainname.be”
    hreflang=”de_DE” href=”http://domainname.de”.

    2) I have two Dutch language website (one for Holland, one for Belgium). Can they have the same slug for there pages, like this:
    domainname.nl/slug-the-same/
    domainname.be/slug-the-same/

    Or like this:
    domainname.com/slug-the-same/
    nl-be.domainname.com/slug-the-same/

    And I want to know the same for categories and tags if that’s going to cause a problem.

    Kind regards,

    Willem

    http://wordpress.org/extend/plugins/multisite-language-switcher/

  2. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    Hello Willem,

    1) the switcher is quite flexible but it doesn't adds the hreflang param out-of-the-box to the links. You have to add a function to you function.php:

    function my_msls_output_get( $url, $link, $current ) {
        $blog = MslsBlogCollection::instance()->get_current_blog();
        return sprintf(
            '<a hreflang"%s" href="%s">%s</a>',
            $blog->get_language(),
            $url,
            $link
        );
    }
    add_filter( 'msls_output_get', 'my_msls_output_get', 10, 3 );

    2) No problem. This is just configuration of the multisite and the domain-mapper plugin.

    Read on here: https://github.com/lloc/Multisite-Language-Switcher/wiki#howto

    Hope this helps. Cheers,
    Dennis.

  3. Willem-Siebe
    Member
    Posted 1 year ago #

    Hi, this for sure helps!

    I know how to add stuff to my functions.php, so that's not going to be the problem. The only thing is, I don't 'understand' the code you providing me.

    So, just to be sure.... ;-)

    Is the output like nl_NL, nl_BE, fr_BE (so language + region) or is the output nl, fr, de (only language)?

    Kind regards,

    Willem

  4. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, it's the complete language-code (language and - if provided by WordPress - the region too).

    Cheers,
    Dennis.

  5. Willem-Siebe
    Member
    Posted 1 year ago #

    Hi, oke thanks. I had a look into my WP panel, but how is going WordPress to provide the region? Where do I have to fill in that a dutch website is for the Belgium country (region)?

    Second question: How does the plugin know which pages/post are available in the other language? Because I don't want the flag to be shown when the page or post is not translated.

    Kind regards,

    Willem

  6. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    You should look for nl_BE-translation-files like discussed here: http://make.wordpress.org/polyglots/tag/nl_be/. I don't know if there is something you can work with but maybe you can ask there.

    Your second is no problem: You can set this up in the plugin-settings.

  7. Willem-Siebe
    Member
    Posted 1 year ago #

    Hi,

    Thanks for you quick reply.

    I think I understand it now (please confirm after reading):

    You told me that your plugin uses the language and region provided by WordPress. I was not sure how I can do this setting in WordPress in order to get your plugin to work. But do I understand it correctly that I need to have the correct language files installed in the language folder in WordPress?

    So for example the nl_BE language file on my Belgium site and the nl_NL language file on my Dutch site?

    Kind regards,

    Willem

  8. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, but all these language-files are in the same directory (/wp-content/languages) in a multisite-installation.

  9. Willem-Siebe
    Member
    Posted 1 year ago #

    OK, thanks.

    I assume because of your statement:

    Yes, it's the complete language-code (language and - if provided by WordPress - the region too).

    that it is also possible to have a languagefile in the directory only - nl -. So without the region. This would be neccesarry when I want to target the dutch language, but not a specific region.

    Kind regards,

    Willem

  10. Willem-Siebe
    Member
    Posted 1 year ago #

    I found this:

    So, the Brazilian Portuguese file would be called pt_BR.mo, and a non-specific Portuges file would be called pt.mo.

    So I assume it's possible. Please correct me if I'm wrong.

    Source: http://codex.wordpress.org/Installing_WordPress_in_Your_Language

  11. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    No it depends on the language. ;) Please have a look here:

    http://codex.wordpress.org/WordPress_in_Your_Language

  12. Willem-Siebe
    Member
    Posted 1 year ago #

    Hi,

    Now I'm confused. Your plugin is for setting up a multilanguage site using a WordPress network.

    Let's say I want to achieve this:

    <link rel="alternate" hreflang="nl" href="http://nl.example.com/" />
    <link rel="alternate" hreflang="es-ES" href="http://es-es.example.com/" />
    <link rel="alternate" hreflang="es-MX" href="http://es-mx.example.com/" />

    As you can see I only use hreflang="nl" because I only want to target the language and not a specific region (because I want to rank in Belgium and Holland with one version).

    1) Source: http://codex.wordpress.org/Installing_WordPress_in_Your_Language

    If you have a site network (WordPress multisite), the language is set on a per-blog basis through the "Site language" option in the Settings->General subpanel.

    Can I set the language only to 'nl' or does it always need to be a language code + country code?

    2) Source: http://svn.automattic.com/wordpress-i18n/

    nl/
    nl_BE/
    nl_NL/

    Source: http://codex.wordpress.org/Installing_WordPress_in_Your_Language

    So, the Brazilian Portuguese file would be called pt_BR.mo, and a non-specific Portuges file would be called pt.mo.

    For the languagefiles it seems possible to only use the language code, do you agree?

    3) In the end, is it possible to have your script make the hreflang output I mentioned in question one?

  13. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    1 + 2)

    You could - of course - try it out but (and this is just my personal opinion) I don't believe that - if it works - you'll have that big advantage with a setup like this:

    nl/
    nl_BE/
    nl_NL/

    If you look into http://svn.automattic.com/wordpress-i18n/nl/trunk/messages/ you'll find just the ns_NL-files. But let me know if it works for you...

    3) Yes ... read on here:

    https://github.com/lloc/Multisite-Language-Switcher/wiki/Use-the-blog-collection-in-your-functions-%28and-filters%29

  14. Willem-Siebe
    Member
    Posted 1 year ago #

    Hi,

    No, I just showed you nl/ , nl_BE/ and nl_NL to show you I think it is possible to have the language file nl/.

    I showed you before:

    <link rel="alternate" hreflang="nl" href="http://nl.example.com/" />
    <link rel="alternate" hreflang="es-ES" href="http://es-es.example.com/" />
    <link rel="alternate" hreflang="es-MX" href="http://es-mx.example.com/" />

    So that does not mean I want to use nl/ , nl_BE/ and nl_NL. I want to use:

    nl/
    es_ES/
    es_MX/

    That is the confirmation I hope to get from you that's possible.

    Kind regards,

    Willem

  15. realloc
    Member
    Plugin Author

    Posted 1 year ago #

    Yes. I think that is possible. ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.