drupal language switcher unaware of the aliases? switches to node/XX/ instead of LANG/text - drupal

I have a big problem with the language switcher,
I have a multi language site that has every article in english and spanish , spanish being the default
so if one article is named :
domain.com/mi-articulo then the english one will be domain.com/en/my-article (using autopath is creating these aliases)
now this works fine if I manualy change the url.. but if I use the language switcher ..the english corespondent it's switches without aliases and Lang prefix
so instead of domain.com/en/my-article it finds domain.com/node/47 so as I have the menu and other things translated it makes drupal unaware of the language switched..
here are the screenshots to better understand what's happening (wierd behaviour)
ver1. spanish
ver2. english
now if i click on english ..look what happends (see url and content like drupal is not aware that this content is nor spanish nor english...because the language switcher doesn't find the aliases)

I had the same problem until I set the default 'Language domain'
in admin/settings/language/edit/en. Now the module is working as expected.

I stumbled upon the same issue today.
All nodes had been imported from another site. All translations were imported, but not the relationship between them, so if you edit a node and check the translations, you may notice that your node doesn't have any given translation.
If this is your issue, you may use the functionality to add existing nodes as translations.

I have the same problem with the language switcher; just cannot get it to do what it's supposed to do. I ended up effectively writing a very simple version of it by adding a block and inserting the following html:
<ul>
<li class="first en">English</li>
<li class="last fr">Français</li>
</ul>
It is limited in that it always takes you back to the homepage after a switch but once that's done, links to other nodes continue correctly with /fr in the url.

Related

WordPress responsive menu in chinese language

I am using this plugin in my wordpress website.
https://wordpress.org/plugins/wp-responsive-menu/
But when i translate my website in chinese language menu items not showing. Please can you suggets me how i can translate it?
in this plugins, the folder "lang" is empty... It does not use languages. So you need change php files and i recommend you do not do this.
But if you really need change, use sublimetext or other soft or command line for use best function : "search in folder".
Use WMPL[Multilingual Plugin].
Just install this plugin in your website and just translate each and every menu which has been used in English.{you can even Sync the menus to the selected language}.
When you choose your language the menu gets changed to Chinese language and nothing get affected.
You will most probably need to either change the page encoding or if use an approach like in this answer.
(HTML5) cannot display Chinese characters when using UTF-8

default language by polylang plugin not working

I installed Polylang Plugin and configed that but I have a problem when I set the default language in Persian language the site loaded in English mode and it is not deference if change default language because in any way in run site loaded by English version.
I installed 3 languages: Persian, English, French
Wordpress version is 4.1.1 and Polylang Plugin version is 1.8.5
How can I fixed the default language in fa-IR?
please help me
For me it was the Polylang setting
Detect browser language (When the front page is visited, set the
language according to the browser preference).
Found in wp-admin > languages > settings.
Test to uncheck that.
You can set default language by click on star in Polylang 'Languages' page, there will be a star for default language when someone is visiting your website. Also, don't forget to deactivate detect browser language in Polylang 'Settings' page, I hope this will work.
This works fine for me.
this solution isn't standard! but work for me :)
replace (comment) this line in wp-content/plugins/polylang/frontend/choose-lang.php file (line 185)
$language = $this->options['hide_default'] && ( ( isset( $_SERVER['HTTP_REFERER'] ) && in_array( parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_HOST ), $this->links_model->get_hosts() ) ) || ! $this->options['browser'] ) ?
$this->model->get_language( $this->options['default_lang'] ) :
$this->get_preferred_language(); // sets the language according to browser preference or default language
by
$language = 'fa';
This is not a perfect solution but works for me. Change the following line in wp-content/plugins/polylang/frontend/choose-lang.php (Line no 247):
$this->set_language( $language );
to:
$this->set_language( 'ar' ); //set defalt language name.
If someone still having this problem.
I had the same issue with Polylang. I was not able to switch back to English after switching to Arabic. The problem had the easiest solution though. It appeared I forgot to set Site Language of WP itself in Settings>General as English UK (it was set to English US). After I changed that all worked fine.
ok i have solution. not need any code. when you set default language then need to go settings - than - URL modifications settings and mark first (The language is set from content) enter image description here
is someone have still problem with this, i found solution.
Go to DB > ptqsln_options (you have maybe different prefix) > polylang and at end of json is default_lang and change to your language. It works for me.
I had the same issue. My site was built in Mandarain first. Now, I'm adding English, but Polylang keeps saying the default is English and gives me tons of trouble when adding pages. I've figured out how to fix that.
Go to Language Settings, add the correct "default" language. In my case, Chinese. And double click it then you will see a star on it.
You will also see a star on the first row, the English one, which attaches many pages. And it has a star. Double click to unstar it. Now Polylang will think your default will be the only option soon.
Delete the first English one, which has many pages linked to it. (There's no need to back up.) Don't worry, it won't delete any pages. At this time, you only have one language option for Polylang; in my case, Chinese.
Run the setup wizard again. And you will see Polyland says the site's default language is in Chinese. (Or your correct default one.) Congrats! Now finish the setup as normal.
Go back to the Languages, and add English or the correct intended language back. Then you will see this new English has 0 posts attached to it, and the correct Default Lan has all of the posts to it!
Go to Settings > General and change the Site Language to Farsi. That will change the language of the admin part.
Is this what you've been looking for?

My internal multilingual link point in wrong direction

Have some serious problem with links behaviour in my multilingual site (English (en) and Swedish (sv)). The default languages is English.
I have some nodes with a summery. In the summery I have internal links to my Swedish content. To link to page3 I use sv/page3.
I make a view with the summaries filtered on the language.
If I place this view as a front page all works fine but if I link the view from a translated Menu-link the will be sv/sv/page3.
Hope for help
Will adding slash sign at beginning help? Try using root relative paths instead of relative paths. So don't use sv/page3, but instead use /sv/page3

Plone 4 is rewriting my HTML, can this be disabled?

We have a Plone 4.1 site. When I edit the HTML source of a document to use a path from the root directory (/codes in our case) and save it, Plone will translate the HTML (in our case it becomes ../codes). Is there a way to disable this, at least for this page? We cannot point to it using the file system because this is a virtual directory used to retrieve and display data from MySQL tables.
Here is some code:
<div class="agency_cd">The agency that is reporting the data. Agency codes are fixed values assigned by the National Water Information System (NWIS). A list of agency codes is available. <strong>[ <a class="internal-link" href="../codes/agency_cd_query?fmt=rdb">Tab-separated -- saved to file</a> || <a class="internal-link" href="../codes/agency_cd_query?fmt=html">HTML</a> ] </strong></div>
I change it to:
<div class="agency_cd">The agency that is reporting the data. Agency codes are fixed values assigned by the National Water Information System (NWIS). A list of agency codes is available. <strong>[ <a class="internal-link" href="/codes/agency_cd_query?fmt=rdb">Tab-separated -- saved to file</a> || <a class="internal-link" href="/codes/agency_cd_query?fmt=html">HTML</a> ] </strong></div>
I then save it, but Plone reverts it to the way it was before.
Do file a bug report on this. The component at fault is an output filter that is automatically translating absolute links to the same host to relative ones. That filter probably poses problems for various "inside-out" rewriting schemes.
Meanwhile, I'll bet you can fix this with some custom rewrite rules. Put in a rewrite rule that looks for /codes-and-parameters/codes/(.+) URLs and rewrites them to /codes/$1. That way you won't need to break anything in Plone to work around the problem.
Disable TinyMCE URL Conversions was useful although I could not say it definitely solved my problem. I found that selecting the option on the Plone edit screen to not use the visual editor and edit the HTML seemed to offer a workaround. The link though is not obvious.

drupal translation t() function doesn't do anything...outputs the same text

I've read that using the t('text to translate') I can translate texts in drupal templates. The problem is, this function doesn't do anything. It simply outputs the same text.
I already have a site and I have installed the proper modules so that's not the problem.
I am using this to translate the titles for the blocks in block.tpl.php.
<h2><?php print t($block->subject); ?></h2>
So this outputs the same original text i'm defining in the title of the view as the block. Why? If I had an error shouldn't Drupal output something or log that error at least?
Translation is not magic. You also need to set up the language of your site in something else than english and be sure that the string you display have a translation.
You can check this at this page : exemple.com/?q=admin/build/translate/search (d6 url)
for the t function to work, you have to do the following:
enable the optional core modules called locale (for interface items) and optionally the content translation (for content).
grant the proper permissions for the proper roles
go to site building -> translate interface to access the interface translation page.
hope that helps
-peter
The translation is not being displayed because its not there. You need to add the translation of that particular string, only then the translated string would be rendered. If you have all the required modules in place, then you need to go to "admin/config/regional/translate/translate" and then search for your string; then click on edit and add the translation of that string.
You also need to install the Locale module and provide translations in the languages you want to support.

Resources