Jump to content
TNG Community
boonie67

Switching Languages

Recommended Posts

boonie67

Switching languages: In an earlier post KRoy writes Tng does not provide a way to tranlate the data entered, however I see KRoy has the switch working on his site. How would one go about this?

English

To switch to french with data translated to french, please explain how would this would be done?

Example of new language switch

French

As you can see here the language on the page is still in English, if you change language would it change all language on page as KRoy?

Thanks for any help,

Randal,

Share this post


Link to post
Share on other sites
Ken Roy

Switching languages: In an earlier post KRoy writes Tng does not provide a way to tranlate the data entered, however I see KRoy has the switch working on his site. How would one go about this?

English

To switch to french with data translated to french, please explain how would this would be done?

Example of new language switch

French

As you can see here the language on the page is still in English, if you change language would it change all language on page as KRoy?

Thanks for any help,

Randal,

OurAcadianFamily

Hi Randal,

One approach that you can take is to create the shell page for your intro.php file using the historytemplate.php and then within the intro.php file created from the historytemplate.php where it says to replace the text, use a line like the following

<?php
include($cms['tngpath'] . "$mylanguage/intro.php");
?>

In your English language folder you would have the text that you currently have in your intro.php and in your French language folder you would have the text that you currently have in your introfrancais.php. Both files need to be named intro.php. The content of the file in the language folder should start with the horizontal rule tag and not include the header or left nav portions of the page, nor the footer.

Ken

Share this post


Link to post
Share on other sites
boonie67

Thanks for the reply KRoy,

However if I am able to follow your instructions both the English and French have function errors at the top of webpages with two text entries following it. What if any advice can you give, I must be doing something wrong.

Thanks again,

Randal

Share this post


Link to post
Share on other sites
Ken Roy

Thanks for the reply KRoy,

However if I am able to follow your instructions both the English and French have function errors at the top of webpages with two text entries following it. What if any advice can you give, I must be doing something wrong.

Thanks again,

Randal

Randal,

A URL to the page where the problem is occurring would be most helpful. At a minimum the complete text of the error messages being displayed might help diagnose the problem.

Ken

Share this post


Link to post
Share on other sites
boonie67
Ken Roy said:

Randal,

A URL to the page where the problem is occurring would be most helpful. At a minimum the complete text of the error messages being displayed might help diagnose the problem.

Ken

KRoy,

I am sending as attachments the two intro files English and French then you could see the problem first hand. Maybe you could help me with this problem, I would be grateful.

However if this is too much work could you recommend someone to me for hire to resolve this issue?

Randal

 

Share this post


Link to post
Share on other sites
Ken Roy

KRoy,

I am sending as attachments the two intro files English and French then you could see the problem first hand. Maybe you could help me with this problem, I would be grateful.

However if this is too much work could you recommend someone to me for hire to resolve this issue?

Randal

Our Acadian Family

Randal,

Attached are the files I created from your provided files. The intro.php file is currently setup to be placed in your TNG installation (or root path) directory. The French_updated_intro.php file is intended to be placed in your French folder and renamed intro.php. The English_updated_intro.php file is inteded to be placed in your English folder and renamed intro.php. Notice that the French and English files only contain the content of your page. The intro.php file contains all the TNG page protocol and formatting, header and footer.

You will also need to add the following $text variables to your appropriate cust_text.php file

// add to French cust_text.php
$text['myintropage'] = "Page d'Introduction";
$text['oursiteintro'] = "Introduction";

// add to English cust_text.php
$text['myintropage'] = "Introduction Page";
$text['oursiteintro'] = "Intro";

You can of course change it anyway you wish.

Ken

intro.php

English_updated_intro.php

French_updated_intro.php

Share this post


Link to post
Share on other sites
boonie67

Randal,

Attached are the files I created from your provided files. The intro.php file is currently setup to be placed in your TNG installation (or root path) directory. The French_updated_intro.php file is intended to be placed in your French folder and renamed intro.php. The English_updated_intro.php file is inteded to be placed in your English folder and renamed intro.php. Notice that the French and English files only contain the content of your page. The intro.php file contains all the TNG page protocol and formatting, header and footer.

You will also need to add the following $text variables to your appropriate cust_text.php file

// add to French cust_text.php
$text['myintropage'] = "Page d'Introduction";
$text['oursiteintro'] = "Introduction";

// add to English cust_text.php
$text['myintropage'] = "Introduction Page";
$text['oursiteintro'] = "Intro";

You can of course change it anyway you wish.

Ken

Thank you so much Ken, really works great. Would this code work in the histories?

Randal

Share this post


Link to post
Share on other sites
boonie67
boonie67 said:

Thank you so much Ken, really works great. Would this code work in the histories?

Randal

Ken thank you for the code and I finally figured out the histories.

History of Acadian Families

Switch the language and the whole page switches, it works great, just had to figure out the correct path.

Randal

Our Acadian Family

Share this post


Link to post
Share on other sites
NLapierre

Hi Ken

I want to know if you can help me to setup my switching languages with my files?

If you want, here's my files

Thank you in advance

Normand

custom_page1_En.php

custom_page1_Fr.php

Share this post


Link to post
Share on other sites
Ken Roy

Normand,

 

You need to

  1. cut lines 1-19 from both language specific files. 
  2. Save the lines from one of the files in a separate file that you will call custom_page1.php
  3. Save the new file ( as coded it expects to be in a subfolder to your TNG folder.  If you save in your TNG root folder, you need to remove the ../ before the begin.php in line 2)
  4. Add <?php to the top of each language specific page and save the files in the respective languages folder without the language name (file name should be cust_page1.php only)
  5. Add include ($cms['tngpath'] . "$mylanguage/custom_page1.php") ;   to the bottom of the file created in step 2 above
  6. Add a ?> at the bottom of the file created in step 2

Above procedure is documented on the TNG Wiki as User Pages - Multi-language

 

 

Share this post


Link to post
Share on other sites
NLapierre
Sur 20/05/2018 at 07:46 , Ken Roy said:

Normand,

 

You need to

  1. cut lines 1-19 from both language specific files. 
  2. Save the lines from one of the files in a separate file that you will call custom_page1.php
  3. Save the new file ( as coded it expects to be in a subfolder to your TNG folder.  If you save in your TNG root folder, you need to remove the ../ before the begin.php in line 2)
  4. Add <?php to the top of each language specific page and save the files in the respective languages folder without the language name (file name should be cust_page1.php only)
  5. Add include ($cms['tngpath'] . "$mylanguage/custom_page1.php") ;   to the bottom of the file created in step 2 above
  6. Add a ?> at the bottom of the file created in step 2

Above procedure is documented on the TNG Wiki as User Pages - Multi-language

 

 

Hello Ken,

With your latest explanations you gave me, I did not manage to make the languages work.

I'm using TNG 12.0.1 with template 15 and I'm having trouble configuring the English and French languages.

I can not configure the feature1.php files to feature8.php and custom_page1.php to custom_page2.php.

These configurations must be the easiest because I am not a professional coding php.

Please, can you help me to get there?

Do you need the files?

After all these configurations, where should I place all these files and which text links of the template 15 should I register for each file feature.php and custom_page.php?

Thanks again and have a nice day!

custom_page1_En.php

custom_page1.php

feature1.php

feature2.php

feature3.php

feature4.php

feature5.php

feature6.php

feature7.php

feature8.php

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×