5 of 9
5
Simple Translator (formerly known as Another Language Switcher)
Posted: 06 June 2007 11:14 AM   [ Ignore ]   [ # 73 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

you got it textdriven, it will always use your default language unless another is available.  for embeds though I’d still recommend the conditional approach as I mentioned above.  I’ll continue to look into the switch though.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 06 June 2007 11:27 AM   [ Ignore ]   [ # 74 ]  
Lab Assistant
RankRank
Total Posts:  281
Joined  12-09-2006

Great. Thanks Mark.

It’s only because I’m running sites with 8 languages that I thought switching the name of the template it embeds would be useful. I’ll try it the other way otherwise. Thanks.

Profile
 
 
Posted: 06 June 2007 11:52 AM   [ Ignore ]   [ # 75 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  879
Joined  02-05-2002

textdriven,

Since global variables work now, you could use them to hold the embedded template name.
The global variable would contain its own name as the variable.

{embed="global/{communication}"}

Does that make sense?

ps. I haven’t tested this myself.

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 06 June 2007 11:55 AM   [ Ignore ]   [ # 76 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

Excellent idea Cocoaholic!

<strike>If it works i would absolutely recommend going that way.  I think the way the EE conditionals work; if you have two embeds in an if then an else, it will parse both embeds before running the conditional, not very elegant but that’s the way it is.  That means if your conditional is 10 embeds long you’ll parse 10 pages for each page view.  (Can someone confirm this?  Check your SQL log on a page using conditionals to embed pages and you’ll see queries from the pages that aren’t being called).  If it is the case using a variable in the embed should remedy this.</strike>

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 06 June 2007 12:02 PM   [ Ignore ]   [ # 77 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

Ok, I jumped the gun.  I just tested out my theory above and in fact the embeds are run after the conditional, so it really shouldn’t matter which way you go.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 25 June 2007 07:52 AM   [ Ignore ]   [ # 78 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  405
Joined  09-09-2006

Once again this was exactly what I needed. Great work!

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 25 June 2007 08:37 AM   [ Ignore ]   [ # 79 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

Glad to hear it.  Be sure to post what you’ve come up with!

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 25 June 2007 09:45 AM   [ Ignore ]   [ # 80 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  405
Joined  09-09-2006

You may be able to see it already if the DNS has reached you..

I used your great work here
http://www.exaprotect.com/resources/newsletters to switch the language of the newsletter and articles

I also used your fantastic pages module on this site

I’ll put it up in the site introductions with a credit for you once I’m sure the DNS has washed through and after a couple of days of bedding in.

THANK YOU MARK!

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 25 June 2007 09:53 AM   [ Ignore ]   [ # 81 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

it looks great.  is there a reason though that there’s so much redirecting?  it pushes me back to the ‘site/newsletter’ page before sending me back again to the ‘resources/newsletters’ page i was on.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 25 June 2007 10:00 AM   [ Ignore ]   [ # 82 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  405
Joined  09-09-2006

Yes that was an issue I’m looking to resolve.

I’m using already using an .htaccess rewrite on the newsletter page

As the switcher extension builds the URL from Segments switching languages was sending it back to /site/etc…

So the quick and dirty solution was to redirect it back. Not ideal and something to tidy up after the launch.

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 25 June 2007 10:16 AM   [ Ignore ]   [ # 83 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

Strange, because if you’re on the resources/newsletters page the extension should just link you to resources/newsletters/lang/_suffix_ and then back to resources/newsletters.  Is this not how it behaved?

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 25 June 2007 10:47 AM   [ Ignore ]   [ # 84 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  405
Joined  09-09-2006

Mmm I did

<?php
echo $_SERVER['PHP_SELF'];
echo
$_SERVER['REQUEST_URI'];
?>

and got

/index.php/resources/newsletters
resources
/newsletters

I was under the impression that segments get built from the template level which would make sense for the URL that is getting generated.

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 25 June 2007 10:52 AM   [ Ignore ]   [ # 85 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

right, can you try this:

<?php
global $IN;
print_r($IN->SEGS);
?>

It’s strange, because there’s no reason that I can see that it would redirect back to site/newsletters

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 25 June 2007 11:15 AM   [ Ignore ]   [ # 86 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  405
Joined  09-09-2006

Array ( [1] => site [2] => newsletter )

I’ve the following redirects:

# Newsletter Archive #
RewriteCond %{REQUEST_URI} /resources/newsletter_archive/$
RewriteRule ^.*$ /resources/newsletter_archive/$ [L]
RewriteRule
^resources/newsletter_archive/(.*)$ /index.php/site/newsletter_archive_detail/$1 [L]

# Redirect translation links #
RewriteRule ^site/news_detail/(.*)$ /resources/newsletters/$1 [R=301,L]
RewriteRule
^site/newsletter/$ /resources/newsletters [R=301,L]

# Newsletters #
RewriteCond %{REQUEST_URI} /resources/newsletters/$
RewriteRule ^.*$ /resources/newsletters/$ [L]

# Newsletter Categories #
RewriteRule ^resources/newsletters/subscribe(.*)$ /index.php/site/subscribe/$1 [L]
RewriteRule
^resources/newsletters/category(.*)$ /index.php/site/newsletter_category/$1 [L]

RewriteRule
^resources/newsletters/(.*)$ /index.php/site/news_detail/$1 [L]

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 25 June 2007 11:20 AM   [ Ignore ]   [ # 87 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

Ok, I think I see now.  Glad to know it’s not the extension pushing all those reloads.  Basically I see your redirecting the lang/suffix to site/news_detail with is then redirecting to resources/newsletters.  I can’t really say if that’s a good thing, but it does appear to be working so I’d go with it.  Really I just wanted to be sure that it wasn’t the extension messing up.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 25 June 2007 01:05 PM   [ Ignore ]   [ # 88 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  405
Joined  09-09-2006

Yes not ideal but is working at the moment.

Thanks again.

 Signature 

Shape Shed | Usable, elegant web design, London, UK
Twitter | Flickr | LastFm | Blog | EE addons

Profile
 
 
Posted: 26 June 2007 07:59 PM   [ Ignore ]   [ # 89 ]  
Lab Assistant
RankRank
Total Posts:  104
Joined  09-19-2006

Hi Mark - fantastic extension! I was wondering if there’s an easy way to get this extension to switch category custom fields (for example switch the default cat_name to a new custom field called cat_name_fr).

This would take advantage of the new 1.6 features and would save me from maintaining identical category group structures.

What do you think?

Profile
 
 
Posted: 26 June 2007 08:00 PM   [ Ignore ]   [ # 90 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1184
Joined  01-05-2006

Oh, you’re one step ahead of me bcartier.  Good idea, and hopefully that will make it’s way into the next revision.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
   
5 of 9
5
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64944 Total Logged-in Users: 70
Total Topics: 81925 Total Anonymous Users: 49
Total Replies: 440355 Total Guests: 294
Total Posts: 522280    
Members ( View Memberlist )