Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Chouby

    (@chouby)

    For the 1st question, see:
    https://www.ads-software.com/support/topic/plugin-polylang-identical-page-names-in-different-languages?replies=8

    pll__() and pll_e() translate strings registered with pll_register_string. The translation is done in the Polylang backend and is stored in the database. This is useful for translating user defined strings such as plugins or themes options or just the site title.

    __() and _e() translate static strings stored in .mo files.

    Thread Starter JustMeSander

    (@justmesander)

    First of all thanks =)

    What are the advantages of pll__? or is it just a preference.
    Because the default translation system works pretty good. Only disadvantage in my opinion is all the stuff that comes with plugins to translate the .mo files (Wich is pretty good done in polylang no non needed additional stuff etc).

    I’m gave that script a try from the other topic, but it’s not working in WP 3.5 (I will fix it and post it here)

    I also have one other problem.
    When i hit https://www.example.com/ i get nicely redirected to
    https://www.example.com/en/home but https://www.example.com/en/ doesn’t seem to work and i get a blank page while i expect the home page without redirect.

    Or a redirect from https://www.example.com to https://www.example.com/en/

    I solved it for now by adjusting the index.php, but that is just a quick fix.

    Thread Starter JustMeSander

    (@justmesander)

    Got a solution for the redirect with static pages,
    https://www.example.com redirects now to https://www.example.com/en/ instead https://www.example.com/en/home

    In core.php

    On line 386
    is_string($redirect = $this->get_home_url($this->curlang))
    Changed to
    is_string($redirect = $this->get_home_url($this->curlang, false, true))

    On line 854
    get_home_url($language = ”, $is_search = false)
    Changed it to:
    get_home_url($language = ”, $is_search = false, $is_frontpage = false)

    And on line 867
    (!$is_search ….
    Changed it to: (where $is_frontpage means it is the frontpage of the frontend)
    (!$is_frontpage && !$is_search ….

    Still getting an empty page, but solved that in the index.php
    (still looking for a nice solution)

    get_header();
    echo apply_filters(‘the_content’, get_page(pll_get_post(71))->post_content)
    get_footer();

    Plugin Author Chouby

    (@chouby)

    Got a solution for the redirect with static pages,
    https://www.example.com redirects now to https://www.example.com/en/ instead https://www.example.com/en/home

    This is the goal of the option: “When using static front page, redirect the language page to the front page in the right language.” Did you check it?

    Thread Starter JustMeSander

    (@justmesander)

    You are right, don’t know how i could miss that.

    I’m making a little progress with the slugs, I will post it here when it’s done.

    JustMeSender, I posted a topic about this problem (not the solution):
    https://www.ads-software.com/support/topic/url-structure-question?replies=3

    So I am very interested in finding a solution. I hope that this will be integrated into the Plugin core by Chouby, instead of just represent a hack.

    I’ll be hoping for the best…

    Thread Starter JustMeSander

    (@justmesander)

    Thanks for the notice =)

    I didn’t have much time to look into the code for a solution, but i really need it so i need to make time for it soon, hopefully I/we can find a solution that’s good enhoug instead of a hack.

    My first idea was to create a slug (actually post_name) with a prefix, but i just don’t like the idea of that and i think it will create other problems in wordpress (and it’s just ugly).

    Also i need to walkthroug the code of polylang so i can come up with a solution.

    Can’t you work together with Chouby, the plugin’s author, on this?

    This is a major future when it comes to language management…

    Thread Starter JustMeSander

    (@justmesander)

    Well I don’t know Chouby, and I guess he’s busy too.
    And I really don’t know the code, so I have to go through it anyway =P

    BUT: I noticed that when i go to
    https://www.example.com/es/contact/
    that my browser redirects me to
    https://www.example.com/nl/contact/

    (the contact page for ES is “contact-2”)

    So i’m going to look into it today =)

    Well, I hope your investigation will lead to the solution…
    Keep it up, and thanks for your efforts!
    ??

    Thread Starter JustMeSander

    (@justmesander)

    Ok that was a dead end.

    What the problem is, is that wp loads the page from the slug.
    And polylang extracts the language from the permalinks (or something else) and compares that to the post language. Otherwise the page is redirected to the right language. But on that point it’s to late to alter the main WPQuery that loads the page.

    I need to find the right action/filter to alter the incoming request (main WP Query). if you remove the redirect and navigate to /es/contact you get the contact page but not in the right language.

    Plugin Author Chouby

    (@chouby)

    https://www.example.com/es/contact/
    that my browser redirects me to
    https://www.example.com/nl/contact/

    That is an intentionnal canonical redirection done by Polylang.

    If you need to remove it, this should do the work (not tested):

    add_action('setup_theme', 'remove_polylang_canonical');
    function remove_polylang_canonical() {
      global $polylang;
      remove_action('wp', array(&$polylang, 'check_language_code_in_url'));
    }

    Chouby, the code works and not works ??
    Now I have the desired url but the content is the same.

    website.com/contact
    website.com/fr/contact

    But the same content(the content from the default language page) on both pages.

    Plugin Author Chouby

    (@chouby)

    You can’t have the same slug for two different pages. That’s a limitation of WordPress that Polylang does not remove. This starts to be a frequent request. I will however not include this feature in v1.1. Maybe later.

    Sorry for digging up an old thread, but has there been any progress with this feature? We really need this for a big site. I guess I could hack together a really simple mod_rewrite RewriteRule for this so that the public URL is different from the internal one, but that doesn’t feel right.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘non unique slugs, and an other question’ is closed to new replies.