Search

If using the cachelight extension, so all dynamic pages become static pages served from cache, doe this extension keep working? Each time a page loads, it reads the server header, does it keep doing this? If one would want to apply 100% static pages, the only way to language detect is using apache?

Hi Klaftertief,

Thank you for your comment. My Symphony version is 2.1.1

If i click on the link in my navigation where i have attached the event then the url is “http://www.mywebsite.net/nl/page/”

(I also changed my browser language to English, but i get the same result)

I get the following (symphony) error: Page Not Found The page you requested does not exist.

If i manually remove the /nl/ from the url, the browser still automaticly redirects me to /nl/ (and i still get the same error…)

-Do i have to make some directions called “nl” “de” “en” etc. in my ftp?

-Do i have to add something into an XML file? I didn’t noticed that i had to..

Thnx!

@newnomad

AFAIK the Language Redirect extension is compatible with the CacheLite extension. To test it check the “Show comments in page source?” checkbox in the CacheLite preferences (then you can see if a cache file i created or the page is served from a cache file) and make sure to visit your page without having a backend session, otherwise caching is disabled.

@DINGDONG

-Do i have to make some directions called “nl” “de” “en” etc. in my ftp?
-Do i have to add something into an XML file? I didn’t noticed that i had to..

Nope.

Do you have a page with the handle “page”? Can you access “http://www.mywebsite.net/page/” (without language part) with the extension disabled/event removed from the page?

You only have to create pages as normal, install the extension, set some language codes in the preferences and attach the Language Redirect event to your multilingual pages.

If you are comfortable with it you can also send me access data of your page to jonas [at] klaftertief [dot] de and I’ll have a look.

To anyone who wants to disregard the language region from browser accepted languages, this should be added to line 57 (at the beginning of the foreach loop):

if (strpos($language, '-') !== -1) {
    list($language, $region) = explode('-', $language);
}

Edit: I’ve added to my Symphony todo-list to make some proper logic for supporting browser languages with and without region specificity, and I’ll send a pull request to klaftertief when I get it done.

Froded, will that logic also consider safari’s flawed language string? Unlike other browsers it only returns 1 prefered language, and doesn’t even include the region.

Hm, I’ve actually only tested this in Safari so far. In my Safari it only sends one language, but it does include region (en-gb). This fix should not have any problems with more language codes and the strpos check is for ignoring languages without region. To be clear, this is a few extra lines inside the foreach loop over all browser languages, thus it only pre-processes and strips any region from one language at a time before checking if it’s one of your supported languages.

But this fix will not work if you have any supported languages with region in your settings, that’ll require a bit more logic (and thus on my todo list for a future patch).

Language Redirect updated to version 1.0 on 1st of February 2011

This is a cleanup and compatibility update for the forthcoming Symphony 2.2. And there is a change that may affect other extensions. The name of the key of the stored language codes in /manifest/config.php changed from languages to language_codes. You have to use

Symphony::Configuration()->get('language_codes', 'language_redirect'))

now to get the language codes.

@klaftertief

I sent you a pull request for a new translation. Can you confirm it, please?

It is my first attempt to use pull request on github so I need some feedback if it worked.

Thank you.

Language Redirect updated to version 1.0.1 on 4th of February 2011

  • Added Romanian translation. Thanks, @vladG.

I’m unable to enable this extension on a Symphony 2.1.2 installation. I’ve tried both by adding it as a git submodule and by installing it manually (and verifying permissions). In either case the extension doesn’t respond to an “Enable” action in the admin interface, but remains disabled with gray text.

Any ideas what could be wrong?

What version of the extension are you trying to install?

[…] (and verifying permissions)

In the installation process (and when you save the preferences) the extensions needs to write to the .htaccess file. Is it writable by PHP? Are there any Language Redirect rules in there? They look like

### LANGUAGE REDIRECT RULES start
...
### LANGUAGE REDIRECT RULES end

…the extensions needs to write to the .htaccess file. Is it writable by PHP?

Ah, that’s it! Thank you so much. I don’t know why that didn’t occur to me. I had it working on my local dev setup, but couldn’t install the extension on my qa or live servers. Had to chmod 777 the .htaccess to make it work.

Thanks for the help — and for a great extension!

(I apologize in advance for my poor English and if my post is silly)

Hi. I'm new to Symphony and this is my first post! You guys are doing a great job here!

I'm writing because I'm having some trouble with this extension in a edge case; I don't know if it is my mistake or a bug (or a feature...). The thing is that this url {$root}/whatever (whatever is a string without slashes) is causing this error:

Line: 158 - XSLTProcessor::transformToXml(): runtime error: file /Users/juanfornos/Sites/jf/workspace/utilities/master.xsl line 16 element variable Line: 158 - XSLTProcessor::transformToXml(): Variable 'url-language' has not been declared. Line: 158 - XSLTProcessor::transformToXml(): xmlXPathCompOpEval: parameter error Line: 158 - XSLTProcessor::transformToXml(): I/O warning : failed to load external entity "/Users/juanfornos/Sites/jf/workspace/lang/labels." Line: 158 - XSLTProcessor::transformToXml(): runtime error: file /Users/juanfornos/Sites/jf/workspace/utilities/master.xsl line 16 element variable Line: 158 - XSLTProcessor::transformToXml(): Evaluating global variable var/param being computed failed

I'm using the url-language param to load an xml containing the labels in the current language (labels.en.xml or labels.es.xml).

Summing up, in my scenario, url-language isn't defined when using this type of url {$root}/whatever and is causing a fatal error (whatever is a string without slashes). Any thoughts about this?

I'm using Symphony 2.2 on Mac OS X 10.6.6.

Thanks!

Can you pastie your XSLT?

That was a quick response...

Thanks!!! :)

EDIT: sorry, code in next post...

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:import href="../utilities/navigation.xsl"/>
<xsl:import href="../utilities/design.xsl"/>
<xsl:import href="../utilities/random-header.xsl"/>
<xsl:import href="../utilities/language.xsl"/>

<xsl:output method="xml"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

<xsl:variable name="labels" select="document(concat('../lang/labels.', $url-language, '.xml'))/labels/label"/>

<xsl:template match="/">

<html>
    <head>
        <title>
            <xsl:value-of select="$labels[@id='page-title']"/>
        </title>

Hm, it seems you are on a page where the $url-language parameter is not set. You could pre-declare it above the line with your default language

<xsl:variable name="labels" select="document(concat('../lang/labels.', $url-language, '.xml'))/labels/label"/>

with something like

<xsl:param name="url-language" select="'en'"/>

or create a parameter $current-language and use that in the labels variable

<xsl:param name="current-language" select="/data/events/language-redirect/current-language/@handle"/>
<xsl:variable name="labels" select="document(concat('../lang/labels.', $current-language, '.xml'))/labels/label"/>

And don't forget to include the Language Redirect event on multilingual pages.

@czheng and @klaftertief:

Thanks for your time and help. I don't know what happend, because I didn't change anything, and the symphony fatal error disappeared.

Now I can't replicate it. It doesn't matter how hard I try... I tried with Chrome, Safari and Firefox, cleaning the cache, the cookies, closing the browser, closing the window, restarting the computer and nothing...

So I guess it was a crazy cache issue.

If I find the error again I'll let you know.

I apologize. Next time I'll test more before posting.

hmm.. not compatible with 2.2.1

I've got it working on a 2.2.1 site. What are your problems?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details