Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-07-25 10:22:31

mungy
Member
Registered: 2006-03-12
Posts: 22

Bilingual website

I’m making a website for a friend that has to be in English and Welsh. I have searched, but can’t find anything specific enough and anything beyond HTML normally breaks my brain. Any help would be most welcome.

Offline

#2 2009-07-25 15:03:41

mungy
Member
Registered: 2006-03-12
Posts: 22

Re: Bilingual website

I’m trying to work it out, really I am.

I intend to use category 2 to select the language of each article. That seems straight forward enough. What I don’t understand at all is how to pass the language selected in a form (I’d much rather have a link, but that has stumped me as well) onto all subsequent pages until the language is changed by the user.

I’d like to do a site wide change of language including the navigation bar and anything else on the page. I really could do with some help.

Part of my problem is that I’m a very infrequent html writer and even less a php mangler. Also my disability means I have regular logic failings and occasional disorganised thinking.

So far I have one page – not going any further until the language thing is workable – cos I don’t fancy trying to fix it when its 20 pages long and I’ve long since forgot what I did to get there.

Please dig deep into your code, experience and extensive knowledge and give generously.

I’ll even buy you a pint if every we should meet unexpectedly in some odd corner of the world, Wales in this case.

Offline

#3 2009-07-25 15:16:58

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Bilingual website

Hi Mungy,

could the multilingual publishing pack for Textpattern the solution to your problems?

And you also have a poorman’s solution here.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2009-07-25 15:40:07

mungy
Member
Registered: 2006-03-12
Posts: 22

Re: Bilingual website

Thanks for the response. The Multilingual plugin either doesn’t have welsh/cymraeg as an option or I couldn’t figure how to use it.

the poor man’s solution might work – it depends how I can get the user to select the language.

You wouldn’t believe this, but it has kept me awake half the night trying to figure out how to get the user to select the language.

You know I once spent 2 years on and off trying to figure out how to automagically change a site logo every month using php. It was only afterwards that I discovered Bloke had made a plugin that could do that and probably more besides.

You coders are sooo annoying ;)

Offline

#5 2009-07-25 16:36:59

mungy
Member
Registered: 2006-03-12
Posts: 22

Re: Bilingual website

Maniqui, I like the idea of how you did your site using sections. If you would be willing to explain how you made it work I would be most grateful. I usually make each page a section as in the past confusion has reigned when I have implemented conditional statements.

Also, I have no idea what the PHP in the poor man’s solution means but I do get the basic idea of how it works. How to I get the user to load the txp variable with their language choice other than via the users browser language?

Thanks.

Offline

#6 2009-07-25 18:13:12

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: Bilingual website

An other poorman solution…

The user could select the language by clicking on a link (flag image ?) .
I use this on this site . (see the link on the flags).

I store the user choice in a cookie.

Menus and messages :
I store the language translations in 2 files where I define constants.
If user choice the FR flag, I load the french translation file. If NL flag, dutch file.

Articles :
Here the site is an expressionengine site where I’m able to build custom textarea fields. (txt/title in FR, txt/title in dutch).
With textpattern, use the poorman solution above, or store one language in body, and translation in the excerpt ? other title in a custom field … ???

<txp:php>
$langue="";
$lang="";
$lang= @$_GET["lang"];
if ($lang) {
$langue=$lang;
$expire = 365*24*3600;
setcookie("lang", $lang, time() + $expire,"/");
}else{
$langue = @$_COOKIE["lang"];
}
switch ($langue) {
case "fr":
   include('fr-lang.php');
   break;
case "nl":
   include('nl-lang.php');
   break;
default:
   include('fr-lang.php');
}
</txp:php>

Last edited by jpdupont (2009-07-25 18:14:30)

Offline

#7 2009-07-25 19:34:04

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: Bilingual website

In this website I previously used the MLP plugin. But for some reasons, I’d change it with my “pourly” method (it’s a TXP 4.0.6 version without the variable magic tag). If this is what your’re lookin for, I can share all features.

Edit: Fixed the link

Last edited by jstubbs (2009-07-25 19:39:09)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#8 2009-07-25 19:43:49

mungy
Member
Registered: 2006-03-12
Posts: 22

Re: Bilingual website

Pat64 wrote:

In this website I previously used the MLP plugin. But for some reasons, I’d change it with my “pourly” method (it’s a TXP 4.0.6 version without the variable magic tag). If this is what your’re lookin for, I can share all features.

Yes please. That does what I want, apart from tidy urls.

Does anyone know if it is possible to load the txp variable using a link and tell me how? Then I reckon I can crack on with the site.

Offline

#9 2009-07-26 00:05:11

mungy
Member
Registered: 2006-03-12
Posts: 22

Re: Bilingual website

right.

If I make 2 sections and 2 pages, english and welsh. and with links at the top of each page for the languages.

then add something like to the english page:

<txp:variable name="choose_language" value="eng" />

and this for the welsh page

<txp:variable name="choose_language" value="cym" />

Will I then be able to use the conditional tags or even Blokes spiffing plugin to change the language of each article depending on the value of the variable?

Offline

#10 2009-07-26 06:20:27

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: Bilingual website

You could use adi_gps to load a variable from a link (from GET, POST or COOKIE).

Offline

#11 2009-07-26 09:04:50

mungy
Member
Registered: 2006-03-12
Posts: 22

Re: Bilingual website

jpdupont wrote:

You could use adi_gps to load a variable from a link (from GET, POST or COOKIE).

thank you. I will look into it.

Offline

#12 2009-07-26 13:35:20

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Bilingual website

mungy wrote:

Thanks for the response. The Multilingual plugin either doesn’t have welsh/cymraeg as an option or I couldn’t figure how to use it.

Actually the MLP pack does support Welsh, the language code you need is ‘cy’. However, that doesn’t mean that there is a Welsh set of strings available for Textpattern or any of the other plugins. You might want to get in contact with the forum’s very own Graeme as he has used the MLP pack to do bilingual English/Welsh sites IIRC.


Steve

Offline

Board footer

Powered by FluxBB