Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2013-01-14 08:21:42

josswa
Member
Registered: 2013-01-14
Posts: 2

Language functionality?

Hi. First off - I'm new to TTG but I love it and how it empowers me to do something that would otherwise be totally beyond me. Good work!

I have a request though for future developments. Is there any way of building a multi-language functionality into CE2 Pages? I'm bilingual and I want to have the option of presenting the site in either language, thus multiplying how many people I can reach. Otherwise, I imagine I would have to make a different site and domain name for each one, which is hardly an elegant solution.

Please let me know if this is already possible or if it could be a development in the near future.

All the best,

- J

Offline

#2 2013-01-14 14:05:26

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Language functionality?

Not likely. Lightroom offers a limited architecture, and creating duplicate content in multiple languages is something not well suited to what we have to work with here.


Matt

The Turning Gate, http://theturninggate.net

Offline

#3 2013-02-16 17:56:54

phillip
Member
Registered: 2012-11-19
Posts: 27

Re: Language functionality?

I've been wanting a dual language site as well and have been thinking about the most elegant way to do it.

So far I've only come up with.

1.Write the other language under the text of the other where necessary.
This would make the pages longer and perhaps annoying to some.

2.Could one make another nav bar for the other language?  At first I was thinking about the footer and that might be a good compromise if possible, but that wouldn't seem possible bec it just copies the main nav bar, unless their is a hack to separate them.  Matt or someone else know a hack for this?  Or would it be possible to create a two-tiered top level nav bar instead of just having to make all the labels unpleasantly small on one long nav bar?

Any other ideas?

Much Thanks

Last edited by phillip (2013-02-16 18:00:16)

Offline

#4 2013-02-16 20:56:01

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Language functionality?

With a static system such as our's, the only way to create a dual language site would be to create the site twice -- once in each language -- then store each site in a separate folder or subdomain. Our products are not designed for dynamic language switching.


Matt

The Turning Gate, http://theturninggate.net

Offline

#5 2013-02-17 11:39:00

phillip
Member
Registered: 2012-11-19
Posts: 27

Re: Language functionality?

It may be possible to create a multilingual site with php.  See link below.  Being a complete newb to website building I don't know specifics about implementing such script into the present files, but I will try to figure out how to do it.

http://jacksonengineering.net/proj_phplanguage.php


Example of script.


<?php session_start();
// session start must be first statement
// do not leave any white space before the php declaration
//the url ? language declaration should have preference over the page name
$pagename = basename($_SERVER['PHP_SELF'],".php");
$pagenamearray = explode(".",$pagename);
if (count($pagenamearray) == 2){ //there is currently a bi-lingual site page loaded
$_SESSION['language'] = $pagenamearray[1];
$urllang = $pagenamearray[1];
}else{ //this page must be a non bi-lingual page
$urllang = 'en';
}
//check for a language selection on the url
if(isset($_GET["lang"])){//language has been passed via url
$_SESSION['language'] = htmlspecialchars($_GET["lang"]); //set it what was found
}
///if there still is no language set, go with english for a default
if(!isset($_SESSION['language'])){
$_SESSION['language'] = 'en';
}
//now we think we have the session language figured out
//
//now check for a version of the current page in the desired language
//lets make some things clear first
//the current page url is either en or de from $urllang
if($urllang != $_SESSION['language']){ //if the url isn't the same as the $_SESSION
if($_SESSION['language'] == 'en'){//if it should be english then load the english
  header("Location: $pagenamearray[0].php");
  exit;
}
if($_SESSION['language'] == 'de'){
  //construct the name of the file if it existed filename.de.php
  $deVersion = $pagenamearray[0] . ".de.php";
  //we have to check if a de version actually exists of this page
  if(file_exists($deVersion)){//redirect if it exists
   header("Location: $deVersion");
   exit;//stop executing things
  }else{$pagelangnotfound = ture;}
}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- do not change the doctype languages as these don't refer to the content language -->

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!-- again, do not ever change "xml:lang" property.
     however one should set the "lang" property to reflect the content language -->
<head>
<title>PHP Language Simple Demo</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<!--The charset declaration is very important here-->
<meta name="description" content="This is the multilingual php website Demo" />
<meta name="keywords" content="php language simple example code" />
</head>

<body>
<?php
if ($_SESSION['language'] != 'en'){
echo 'Sprache: <a href="'. $_SERVER['PHP_SELF'] . '?lang=en">English</a>';
}else{echo 'Language: English';}
?> |
<?php
if ($_SESSION['language'] != 'de'){
echo '<a href="'. $_SERVER['PHP_SELF'] . '?lang=de">Deutsch</a>';
}else{
echo 'Deutsch';
if($pagelangnotfound){
  //if the user has selected german but the current page is not found, this text is displayed
  echo " (Leider gibt es noch keine Übersetzung für diese Seite.)";
}
}
?>
<p><a href="./../../proj_phplanguage.php#simpex">back</a></p>
</body>
</html>

Offline

#6 2013-02-17 13:21:44

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Language functionality?

Interesting find. When I have time to spend on such things, I may need to try working through this.

I think it should be much easier to do language sessions on content in "the block", but not sure how reasonable it would be to localize image captions and other incidental content.


Matt

The Turning Gate, http://theturninggate.net

Offline

Board footer

Powered by FluxBB