vigetlabs / craft-localeredirector Goto Github PK
View Code? Open in Web Editor NEWCraft plugin for detecting user language preferences and redirecting to the appropriate locale.
License: MIT License
Craft plugin for detecting user language preferences and redirecting to the appropriate locale.
License: MIT License
Hi,
I've installed the last version of the plugin and it works well except that two urls.
I've not idea why.
The url is blog and far-q-assioma and they are located in this website https://cycling.favero.com/.
Blog and Faq are two single pages translated in 5 languages.
The URI in the section's setting is (for FAQ for example):
en -> faq-assioma
it -> faq-assioma
fr -> faq-assioma
es -> faq-assioma
de -> faq-assioma
If I go to the website and I choose Italian language
and after, I try to navigate to https://cycling.favero.com/fr/assioma, it redirects well to the italian version of the page. This page has the same settings of blog and Faq
If I try the same, first selecting Italian language and after, I try navigate to https://cycling.favero.com/fr/faq-assioma, it loads the francais version instead of the Italian version without changing the language cookie setting (it remain IT).
Do you have any suggestion about this?
Thanks in advance and regards,
Davide
I make an AJAX call to the URL "${window.baseUrl}actions/podioLead/newLead/" and it redirects it to "${window.baseUrl}/en/actions/podioLead/newLead/" which ends up to Bad request.
This URL points to an action of a custom plugin I have developed. Is there any way to prevent the redirect?
Hay,
I've the following URL structure:
/ => de
/fr => fr
It does redirect me to an entry page instead of the home when i enter www.mydomain.de/ or www.mydomain.de/fr but only when i've switched to an other locale and open the startpage in a new Tab.
Fix:
private function newUrl($locale)
{
$qs = $this->querystring ? '?' . $this->querystring : '';
$segments = craft()->request->segments;
$lastSegment = end($segments);
if ($lastSegment) {
$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->slug = $lastSegment;
$entry = $criteria->first();
if (!empty($entry)) {
$new = craft()->elements->getElementById($entry->id, ElementType::Entry, $locale);
return UrlHelper::getSiteUrl($new->uri, null, null, $locale) . $qs;
}
return false;
}
return UrlHelper::getSiteUrl('/', null, null, $locale) . $qs;
}
You are hardcoded checking on ElementType::Entry
, so for example category urls will not work. Will create a pull request for this.
Following the documentation example, this is working fine:
Requested URL: http://site.com/blog/article-title
Cookie Present: es
Configured Site Locales: en, fr, de, pt, es
Redirects To: http://site.com/es/blog/article-title
But if the slug of article-title is different in es locale (/titulo-del-articulo) , the user is redirected to a 404.
The plugin should probably constructs the new URL using original entry id, not using original path.
Hi,
The plugin seems to force the browser language. It's impossible to switch languages.
I'm using the latest version of Craft and the plugin on a multi-environment setup.
If you want, I could give you access to the code and/or backend.
I've a multilanguage website with Locale Redirector plugin installed on Craft CMS 2.6.2986.
The site base language is English EN.
When a user come inside the website is will be redirect in base of his browser language settings.
But I find this issue:
If a english user (language EN) comes from an external Italian link the plugin doesn't redirect to the correct URL.
That's what happen:
user clicks this url www.sitename.com/it/slug_italian
and it land in this www.sitename.com/slug_italian
instead he sould land in www.sitename.com/slug_english.
The opposite case, an Italian user click on English link, works well and he is correctly redirected.
Here a pratical example:
https://cycling.favero.com/it/supporto
if you have a browser in english language it not resolve the translation but it show you 404.
UPDATE
I've update the plugin with the new version and it seems works well!
Thanks in advance and regards.
Hi
I've just installed your plugin on a Craft CMS 2.6.2950 installation and I'm getting the following error (the error message itself is in German; I've translated it in the subject field and I removed some part if the URL for privacy reasons):
CException
Eigenschaft "Craft\LocaleRedirectorService.path ist nicht definiert.
/home//public_html/_staging/craft/plugins/localeredirector/services/LocaleRedirectorService.php(40)
28 craft()->request->redirect($url, true, 302);
29 }
30
31 // Private Methods
32 // =========================================================================
33
34 /**
35 * Return a new url with locale included
36 * @param string $locale
37 /
38 private function newUrl($locale)
39 {
40 $path = $this->path = craft()->request->getPath();
41 $params = $this->querystring = craft()->request->getQueryStringWithoutPath();
42
43 return UrlHelper::getSiteUrl($path, $params, null, $locale);
44 }
45
46 /*
47 * Set a cookie
48 * @param string $name
49 * @param string $value
50 * @param int $expire
51 * @param string $path
52 * @param string $domain
Any idea?
Regards
Mischa
Hi,
I've just installed the plugin on Craft CMS 2.6.2962 and homepage page isn’t working in console I have an error: net::ERR_TOO_MANY_REDIRECTS
Any idea?
Thanks
F
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.