Add the language toggle block to the Navigation Menus

I forgot the website images sorry.

1

Language Toggle Block At The Right-Bottom of The Website.

2

Hi - your language links in the navigation work correctly for me.

Regards,
Jason

Dear Jason Nugent,

My journal’s language links are working properly in some browsers and some different geographic connections. But they need to work the whole visitors’ different web browsers. In Firefox sometimes the links don’t work. I think that this is a coding problem for browsers. You may read this link:
https://blogs.msdn.microsoft.com/ieinternals/2014/04/22/unicode-in-url-changes-for-ie11/
Maybe there may need a bug for this.

But the language toggle always switch the language page. I added some custom blocks to my journal’s web page and language toggle part is at the right-bottom of the page. The language switcher must be top on the website. I want to carry language toggle top of the website. I couldn’t add what I did the language toggle into the navigation menus or header.

My point is that you can put the language toggle at the top of the page. You just need to drag it up in the journal settings section where you edit the side bar.

But, your language links work for me (and I am using Firefox). Also tested in Chrome and IE.

Cheers,

I can not carry the language toggle block above the custom blocks also above the issue slider. May I replace the language block at the top of the page or near the Search Bar like this?

Is there any idea for this?

@jnugent Yes, we need to know this either: How can we display a working language toggle to the User Menu?

Do we have to develop a plugin for that? Is there a place to hook into?

Hi @twa,

The isn’t any easy way that I know, you can look into Health Sciences or Immersion theme’s code for possibility of implementation.

1 Like

Thanks, @Vitaliy – this is a great starting point!

You can copy the toggle links from the sidebar language toggle and then create new Navigation Menu Items (Settings → Website → Navigation Menus → Add Item) - use “Remote URL” and just copy the links from the language toggler in the sidebar, respectively.

Once you have created three new items (“Language”, “English”, “Turkish”) you can edit the User Navigation Menu to add the language toggler to the top of the page, next to the login.

See for example: lambda nordica

Best wishes,
Emma

2 Likes

This procedure does only create links to the main page. Is it possible to make toggle links so that the current page changes language?

1 Like

I would like to know that, too.

Overall, it would be great if enabling the language toggler meant, not only that it can be added to the sidebar, but also that it could be added to the nav bar. That is, it would be great if the toggler showed up as a Navigation Menu Item to be added (optionally) either to the primary nav menu or the user nav menu.

And where is located the code of Language block?
Another words, how can I get url for current page :?)

Hello everyone,

I suggest this for this url :

  1. Add the language block to the sidebar (you can remove it later if you want). So to add this block, from admin menu, go to Setting>website>Appearance, scroll the window for sidebar management section, then move this block (language toggle block) from the right column (unselected) to the left (sidebar). Then scroll to the bottom of the window to save theses changes.

  2. View the website and scroll the content of the sidebar. Now you see this block, with Language in the title and list of languages below.

  3. Now to have the url of each language, make a right click on it, and from the contextuel menu, choose: copy adress of link

  4. You can, then, paste this link to the url field, after choosing Remote url in the Navigation Menu Type, when creating a menu item for a language.

Thank you to OpenAcademia for the indications. If someone needs more details about integrating languages to the user navigation menu, I’d be pleased to share the whole steps I took to do this. See a screenshot below:
image

Hi, all if it helps I managed to add the language selector in the user navigation menu

What I did is in my theme I overrided the navationMenu.tpl and added the code found in usernav.tpl

{if isset($supportedLocales) && $supportedLocales|@count}
	<li class="languages" aria-haspopup="true" aria-expanded="false">
		<a href="#">
			<span class="fa fa-globe"></span>
			{$supportedLocales.$currentLocale}
		</a>
		<ul>
			{foreach from=$supportedLocales item=localeName key=localeKey}
				{if $localeKey != $currentLocale}
					<li>
						<a href="{url router=$smarty.const.ROUTE_PAGE page="user" op="setLocale" path=$localeKey}">
							{$localeName}
						</a>
					</li>
				{/if}
			{/foreach}
		</ul>
	</li>
{/if}
1 Like

I copied the links from the language toggler in the sidebar
but this only create links to the main page. Is it possible to make toggle links so that the current page changes language:
Can you explain to me your method please?

Have you tried my solution?

I did not understand what I did well, is it possible to put screenshots for clarification

Hi,
can you help me to add the languages toogle in the user navbar as in the screenshot?
Many thanks!

Hi. For the language selector to work, the links must look like this:

href="/user/setLocale/en_US"
href="/user/setLocale/es_ES"

This way you will get to see the translated page, whatever it is, without having to point to the home page.
In OJS3x you can place the selector in the custom header, through the Custom Header Plugin

Regards!