Multilingual - swich language button?

Hi there , what are the steps to implement a swich language button ? like select language button / drop down thing :d

once you activate second language in your builder on the top right you will have a button to switch language.
you can then create all the pages in the second language and the site will be visible under http://your-site-name.com/ES . ES is example for Spanish

2 Likes

I think KAdrian meant how to add dropdown switch of languages in navbar of his website?

If I am correct, if you can wait couple of days, we will create native dropdown switch which you will be able to drag & drop. If it is urgent, I cant help you to build it with custom JS.

1 Like

Lovely I can wait , no rush, thank you

@KAdrian

If you want to give it a try, you can implement some simple switch in footer like show list of languages using the $language variable & iterable system, but as Pakic said, we will do some native way for this soon.

1 Like

@dejan did you had time to get this language switch available ?

@Pakic ? I understand @dejan is probably too deeply involved in something more important. Do you have some cycles to help me?

@xmasrock

I can do this one today/tomorrow, will let you know once is live. Thanks for patience.

2 Likes

Hi @dejan : WYT if in the “Page” object you can expose the current url path ? Then it will be very easy to build the current url version for each language.

@xmasrock

Yeah, there are more ways to build the multi language system, but if you do it with multiple pages, it could work, but you’ll have to maintain a structure on all the different layout pages once you modify something, that’s why Divhunt language system is better as it let’s you use same page, same structure, same style just different content.

I was thinking about something like an iterator set of links:

  • content $language_iterator_with_active_filtered
  • link-type url
  • href ${$Domain->$get(‘link’)}/$language_iterator_with_active_filtered->Lowercase/$Page->get(‘current_path’)}

Isn’t that already implemented ?

I just discovered this thread. I couldn’t find a native language switcher anywhere. Is it possible to implement it using custom JavaScript/code?

@noxic

There’s variable that holds all languages, $language, so you can use Iterable functionality to iterate all languages, the only trick here is that default language isn’t included in route, so you’ll have to handle that.

Thanks, Dejan. Currently, I only have two languages: German and English. What I need is a function that automatically switches between the English and German versions, so between domain.com/original-slug and domain.com/en/translated-slug.

@noxic

So you want to include URI of current page as well? I’ll make today some basic switch and send you, just confirm me if that’s what you need.

Yes, just like a typical language switcher on modern websites in 2024. :slight_smile: Additionally, it would be cool if it could detect the browser language and switch automatically to that language, with a fallback to a manually set default language. For example, if the browser language is not German, then always load English.

Having something like this as an element or block (similar to the swiper block) would be fantastic, making it accessible for everyone to use and configure. That could definitely be something for our roadmap later on. :wink:

But thanks anyway for your always great support and response. I appreciate it very much.

I think later it will be added, just take them time as there is a lot of the team is going to ship :rocket: :woman_astronaut:

Besides all the great improvements you’ve been rolling out, I almost feel guilty asking again if there might be a solution. However, the absence of this feature is currently preventing me from launching a new website that is otherwise ready to go live with DivHunt.
:monkey_face: :monkey_face:

hey Dejan, do you have any tips on how I can create this switch myself?