Description: Allows your users to select the language in which the site will appear from a list you specify.
Because of different versions, number lines are approximate and meant to put you in the general ballpark. They will likely change as you progress through the mod.
Requirements: eFiction 3.X
Mod History:
- June 10, 2007 - Mod created
Difficulty: Easy
Files Involved:
* header.php
* includes/get_session_vars.php
* includes/corefunctions.php
Instructions:
Backup your files and database before you begin this or any other mod!
1. Go Admin-> Profile Information and add a new profile field for your language settings.
Name: language
Title: Language (you may wish to put this in both/all languages)
Field enabled: checked
Type: Select box
Select box: Enter your language options one to a line.
2. In both get_session_vars.php and corefunctions.php find:
if(!defined("_CHARSET")) exit( );
And change to:
if(!defined("_UIDFIELD")) exit( );
3. Open header.php and find these two lines (around line 103)
if(file_exists(_BASEDIR."languages/{$language}.php")) include (_BASEDIR."languages/{$language}.php");
else include (_BASEDIR."languages/en.php");
Cut and paste them so they appear directly below this line (around line 128)
require_once("includes/get_session_vars.php");
4. Just below that same line:
require_once("includes/get_session_vars.php");
add:
if(isMEMBER) { // don't bother unless they're a member;
list($lang) = dbrow(dbquery("SELECT info FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '".USERUID."' AND field = '14'"));
if(!empty($lang) && file_exists(_BASEDIR."languages/".$lang.".php")) $language = $lang;
}
4. Find this line in header.php (around line 118)
if(isset($let) && !in_array($let, $alphabet)) $let = false;
Move it so that it's below the first two lines you moved:
if(file_exists(_BASEDIR."languages/{$language}.php")) include (_BASEDIR."languages/{$language}.php");
else include (_BASEDIR."languages/en.php");
Wow! Many many thanks for it, I've tested it on my dev site and it works.
Just a note to this line:
list($lang) = dbrow(dbquery("SELECT info FROM ".TABLEPREFIX."fanfiction_authorinfo WHERE uid = '".USERUID."' AND field = '14'"));
The field variable may change, depending how many profile fields are installed. I had this to set to '13'. But many thanks for this mod, would be great to see this as a regular feature in future versions.
Steffen
I love this one. Thank you so much!!
But now I have two short questions ... would be great if anyone could help me out with those..
certain parts of the page are still in the language I installed eFiction in (english) for example the Panel-titles and such. As well as some of the profile fields I added.
Is it possible to add those to the language file somehow so with selecting a language in the profile those parts get translated, too?
Also the Account Info bit and the links in the main menu don't translate as they are managed via the block.
Second thing: Email notifications for new reviews, responds and so on... are those stored in the database? Maybe I'm just blind. I'd like to add the same message in German, too but can't figure out where I can change them.
Sorry for asking all these stupid questions.
Old
URL: http://fiction.intayale.de
Version: 3.3.1
Modules: Challenges, Story Tracker, Mulit-lang. eFiction
PHP: 4.4.8
MySQL: 5.0.51a
New
URL: http://intayale.de/deFiction
Version: 3.5
Modules: Last Login
PHP: 5.2.9
MySQL: 5.0.77
The panel titles, site links, profile fields and skin templates have to be translated using the admin interface. These language strings are not stored in the language files, only in the database.
But the mails should go out in the user chosen language. These templates are store in the main files located in the /language directory.
Ah. Thanks. I'll see about the newsletters again.
As far as the panel titles and stuff goes: I know they are not in the language file but in the database. Thing is just: it looks awful to have everything in both languages up there like "Post new Story/Neue Geschichte schreiben" but those things don't translate by user's choice. So my question was actually if there is any way to make that work. I have English and German people on that page. Currently I stick to english links there as most Germans know english but only few english people understand German.
Don't know how to make that point more clear. It's the either/Or - solution that bugs me. 😉
Old
URL: http://fiction.intayale.de
Version: 3.3.1
Modules: Challenges, Story Tracker, Mulit-lang. eFiction
PHP: 4.4.8
MySQL: 5.0.51a
New
URL: http://intayale.de/deFiction
Version: 3.5
Modules: Last Login
PHP: 5.2.9
MySQL: 5.0.77
No, I think that's not possible. The only thing you could do in order to have a real multilingual site is to install two eFictions with same settings but different sql tables for panel data, site links and so on. Your users then could call the english or the german version, depending on their language. www.domain.de/en, www.domain.de/de...
But to get this to work you would have to heaviely modify a lot of script files.
-----
Arg, warum quäl ich Blödmann mir hier einen auf Englisch ab, wenn du doch offenbar deutsch verstehst? 😀 Also das was du erreichen willst, ist nicht so ohne weiteres möglich. Du könntest höchstens 2 eFiction-Installationen laufen lassen, die die gleiche SQL-Datenbank benutzen. Bis auf die Tabellen für Panels, SiteLinks usw. Dann hättest du vielleicht wirklich eine richtige, mehrsprachige Seite. Die User könnten dann über verschiedene URL's z. B. auf die gewünschte Sprache wechseln. Aber da müsstest du dann eine ganze Menge Dateien modifizieren. Viel Spaß dabei. *g*
*sigh* I was afraid it wouldn't be possible. Thanks anyway 😉
***********
Ja, warum quälst du dich auf Englisch ab? *kicher* Damit Leute, die die Frage evtl. auch mal noch irgendwann haben, auch die Antworten verstehen können 😉
Leider bin ich absolut nicht fit im manipulieren von Codes. Ich kann Mods integrieren, nach Anleitung aber ansonsten schon nichts. Also lass ich das mal lieber bleiben... müssen sich halt die Deutschen mit "Add new story" herumschlagen. kann ja ned zu viel verlangt sein 😉
Trotzdem danke für deine Hilfe.
Old
URL: http://fiction.intayale.de
Version: 3.3.1
Modules: Challenges, Story Tracker, Mulit-lang. eFiction
PHP: 4.4.8
MySQL: 5.0.51a
New
URL: http://intayale.de/deFiction
Version: 3.5
Modules: Last Login
PHP: 5.2.9
MySQL: 5.0.77
How I can make it work for version 2.0.7?
