Jump to content

How do I link to a page with a language in a multilingual website?


kaz
 Share

Recommended Posts

I want to link in a page (en) to a page with a second language (de). If I choose "Page" I can only select one page of the same language. I then tried to enter the full URL, https... the page will still be linked to the same language (same page) in the frontend.

How do I link to a page with another language in a multilingual website?

Link to comment
Share on other sites

5 hours ago, Gideon So said:

Hi @kaz,

This is the limitation of the editor link function. Don't use the page selector. You should enter the url by hand.

Gideon

Hi Gideon So,

it does not work, no matter which link I enter manually, the current page is always reloaded. In the source code (frontend) I see the link to the other language, but nevertheless the same page is called. It looks like PW is blocking the whole thing.

I've tried both ways:

a href="https://www. ..."
a href="/de/pagename"

1. the same page is updated in frontend, although another link is called in the source code.
2) In frontend the same page is refreshed, the editor does not allow any language change.

It must be possible to link in an page from one language to another. Especially for lawyers it often happens that one language is referred to another.  Sorry, I can't get it, but this restriction is nonsense.
This restriction must be lifted, in Europe every second page is a multilanguage page ;)

Link to comment
Share on other sites

  • 1 year later...

I'm stumbling into the same issue. I can't believe I haven't run into this before. My site is in Spanish by default, with English as a second language. On one of the pages, the English translation is not available, so my client just wants to link to the default Spanish page with a message in CKEditor that says something like "Please view the Spanish version of this page to learn more about…". But when I try to link to the Spanish version, I always end up on the English version, even if I change the link manually in the source code.

Does anybody know any workaround?

Link to comment
Share on other sites

1 hour ago, jacmaes said:

Does anybody know any workaround?

Editing the link within the dialog or in the source code - like you.

Yet... I never had this challenge before so far.
Tried this now out of curiosity. Don't know any other way right now. 

WOW!

Link to comment
Share on other sites

I wouldn't say I'm stuck... but my clients could end in a dead-end for some reason (this reason).

Most of my multi-language projects just show the default-language content. In case I use RepeaterMatrix (ProFields) the client or I can always add a single text-block that shows something in the non-default language and go from there.

Right now I could imagine using a HannaCode block that lists all available alternative language versions... in your case it would be just the spanish version.

Link to comment
Share on other sites

I've thought about using HannaCode too but it seems like too much overhead and work, especially if I'm not already using it and just need to implement it for this purpose. I just want to link to a page in another language, this is such a simple request that shouldn't require that type of workaround. Plus imagine explaining that to a client: "if you want to link to a page in another language on your site, a simple link like you're used to won't work, you need to insert this HannaCode snippet that…" 🤯

Link to comment
Share on other sites

In a client-case... I would have done probably the same as you and posted here.
Haven't looked through the forums but maybe someone had this issue as well.
Can't really imagine noone else ever had this issue.

But ok... maybe though.

For my personal projects or projects I maintain... I'd go the easiest route for whatever it would be in those cases.

Another idea... you could probably use $page->viewable() within the template.

Link to comment
Share on other sites

Probably not as you already can't choose the languaged-link from within CKEditor.

Or at least we don't know how.

I can manually set any link to wherever in whatever language. That work's totally fine. But... a non-developer can't switch links to different languages.

Link to comment
Share on other sites

I have to manually enter the link in the source code, as choosing it from the link dialog in CKEditor points to the page in the same language. So as @wbmnfktr says, it's no use for a non-developer.

Edit: Just to clarify, before turning off "Link abstraction", I could edit the link manually to point to another language and the changes were correctly saved, but it always redirected me the current language when clicking on the link on the front-end. Now at least there's a workaround, even if it's not client-friendly at all. There should be a visual way to select other languages in the tree. 

  • Like 1
Link to comment
Share on other sites

This whole discussion points to a larger issue: There is no way to visually select a page you want to link to in another language (without diving into the source code or manually editing the link), is there? A simple use case is for a client to be able to link to a page in another language from a CKeditor field.

I have to admit that I've never had the need so far in the 9+ years I've been using PW, but it seems like it should be an option, even if it's hidden by default. What do you guys think?

  • Like 1
Link to comment
Share on other sites

I totally agree and therefore looked through threads but... no chance so far.

Don't know if it's pwlink (CKEditor module from PW) or CKEditor itself that needs to be changed... maybe @ryan can clarify and give us an update.

I guess and bet Ryan could clarify this or can somehow resolve this and the issue @teppo mentioned.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...