View Thread
All MODs and their Supported Threads goes here in this Section.
 Print Thread
[MOD] Switch DB tables to other language with Language Switcher
Wanabo
When you use the Language Switcher you only switch to another set of locale files. Unfortunately the locale files in your infusions folder won't change accordingly. Also the navigation panel (site links) stores the description in the database, these won't change either.

If you want your language switcher to include navigation and infusion translation then follow the instructions.

There are three things to do:
  1. Download mwp_language_switcher_panel and follow the instructions in the install.txt
  2. Make extra tables for all the languages you want to support.
  3. Mod infusions/navigation_panel.php
  4. Mod all infusions witch have their own locale files.


1. See attached file.
2. Make copies of fusion_site_links table, rename the table to Mizo_site_links or Hindi_site_links or what ever locale directory you have. It is important that LOCALE in LOCALE_site_links is an exact match to the name of the locale directory you use.
Edit the contents of the LOCALE_site_links table accordingly to the language you want. (field link_name, leave other fields untouched)
3. Upload navigation.zip or modify yourself.
Find: /infusions/navigation_panel/navigation_panel.php
Download source  GeSHi: PHP
  1. if (!defined("IN_FUSION")) { die("Access Denied"); }
  2. openside($locale['global_001']);
  3. $result = dbquery(
  4. "SELECT link_name, link_url, link_window, link_visibility FROM ".DB_SITE_LINKS."
  5. WHERE link_position='1' OR link_position='2' ORDER BY link_order"
  6. );
  7. if (dbrows($result)) {
  8.  
Parsed in 0.018 seconds, using GeSHi 1.0.8.10

And replace with:
Download source  GeSHi: PHP
  1. if (!defined("IN_FUSION")) { die("Access Denied"); }
  2. openside($locale['global_001']);
  3.  
  4. if (isset($_COOKIE['newlang']) && ($_COOKIE['newlang'] != $settings['locale'])) {
  5. $result = dbquery(
  6. "SELECT link_name, link_url, link_window, link_visibility FROM ".$_COOKIE['newlang']."_site_links
  7. WHERE link_position='1' OR link_position='2' ORDER BY link_order" );
  8. } else {
  9. $result = dbquery(
  10. "SELECT link_name, link_url, link_window, link_visibility FROM ".DB_SITE_LINKS."
  11. WHERE link_position='1' OR link_position='2' ORDER BY link_order" );
  12. }
  13. if (dbrows($result)) {
  14.  
Parsed in 0.011 seconds, using GeSHi 1.0.8.10


4. Modify the infusions you want so you can use the selected language.
Make sure you have a locale file with the exact name as the locale in locale directory. For example: Mizo.php Hindi.php. I've copied the original English.php and renamed it. Translate the contents.

Use the attached shoutbox.zip or modify yourself.
Mod to Shoutbox: /infusions/shoutbox/shoutbox_panel.php
Find:
Download source  GeSHi: PHP
  1. if (!defined("IN_FUSION")) { die("Access Denied"); }
  2.  
  3. include_once INFUSIONS."shoutbox_panel/infusion_db.php";
  4. include_once INCLUDES."infusions_include.php";
  5.  
  6. // Check if locale file is available matching the current site locale setting.
  7. if (file_exists(INFUSIONS."shoutbox_panel/locale/".$settings['locale'].".php")) {
  8. // Load the locale file matching the current site locale setting.
  9. include INFUSIONS."shoutbox_panel/locale/".$settings['locale'].".php";
  10. } else {
  11. // Load the infusion's default locale file.
  12. include INFUSIONS."shoutbox_panel/locale/English.php";
  13. }
  14.  
  15. $shout_settings = get_settings("shoutbox_panel");
  16.  
Parsed in 0.008 seconds, using GeSHi 1.0.8.10

And replace with:
Download source  GeSHi: PHP
  1. if (!defined("IN_FUSION")) { die("Access Denied"); }
  2.  
  3. include_once INFUSIONS."shoutbox_panel/infusion_db.php";
  4. include_once INCLUDES."infusions_include.php";
  5.  
  6. if (isset($_COOKIE['newlang']) && (file_exists(INFUSIONS."shoutbox_panel/locale/".$_COOKIE['newlang'].".php"))) {
  7. include INFUSIONS."shoutbox_panel/locale/".$_COOKIE['newlang'].".php";
  8. } else {
  9. // Load the infusion's default locale file.
  10. include INFUSIONS."shoutbox_panel/locale/English.php";
  11. }
  12.  
  13. $shout_settings = get_settings("shoutbox_panel");
  14.  
Parsed in 0.008 seconds, using GeSHi 1.0.8.10


Use the attached lastseenusers.zip or modify yourself.
Mod to Last seen users: /infusions/last_seen_users_panel/last_seen_users_panel.php
Find:
Download source  GeSHi: PHP
  1. if (!defined("IN_FUSION")) { header("Location:../../index.php"); exit; }
  2. if (file_exists(INFUSIONS."last_seen_users_panel/locale/".$settings['locale'].".php")) {
  3. include INFUSIONS."last_seen_users_panel/locale/".$settings['locale'].".php";
  4. } else {
  5. include INFUSIONS."last_seen_users_panel/locale/English.php";
  6. }
  7. openside($locale['lsup000']);
Parsed in 0.008 seconds, using GeSHi 1.0.8.10


Replace with:
Download source  GeSHi: PHP
  1. if (!defined("IN_FUSION")) { header("Location:../../index.php"); exit; }
  2. if (isset($_COOKIE['newlang']) && (file_exists(INFUSIONS."last_seen_users_panel/locale/".$_COOKIE['newlang'].".php"))) {
  3. include INFUSIONS."last_seen_users_panel/locale/".$_COOKIE['newlang'].".php";
  4. } else {
  5. include INFUSIONS."last_seen_users_panel/locale/English.php";
  6. }
  7. openside($locale['lsup000']."<div style='float:right; display:inline;'><a title='pHp-Fusion.Org | Open Source PHP + MySQL Powered Website' href='http://php-fusion.org/news.php' class='scapmain' style='text-decoration:none;'>&copy;</a></div>");
Parsed in 0.008 seconds, using GeSHi 1.0.8.10
Wanabo attached the following files:
shoutbox_panel.zip [14.72kB / 546 Downloads]
navigation_panel.zip [1.41kB / 532 Downloads]
last_seen_users_panel.zip [3.2kB / 530 Downloads]
language_switcher_v1.zip [14.61kB / 562 Downloads]

Cool
 
Creator
LOL ! hahaha !
Great.
Edited by Creator on 23-12-2012 04:20
 
http://www.samuel.cuccfree.org
Creator
I cannot find mwp_language_switcher_panel for download.
 
http://www.samuel.cuccfree.org
Wanabo
It is attached to my previous post called "language_switcher_v1.zip".
Cool
 
Jump to Forum
New Thread Post Reply
Use BBcode or HTML to refer to; '[MOD] Switch DB tables to other language with Language Switcher'
BBcode:
HTML: