Category and forum names in two languages

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Get Involved
Locked
silentus
Registered User
Posts: 34
Joined: Wed Jul 31, 2013 7:57 pm

Category and forum names in two languages

Post by silentus »

Hi,
i want to make a phpBB3 (3.0.12) forum for people from Poland and other countrys, so i want to have english and polish language, but i have a problem.

The problem is that the langauge only switches button language etc and i would like to have category and forum names in two languages.

Without that i would need to make something like including two languages at once, for example: "Informacje/Information" and i dont really like to do it this way.
User avatar
dellsystem
Former Team Member
Posts: 3879
Joined: Sat Apr 09, 2005 8:54 pm
Location: Montreal
Name: Wendy
Contact:

Re: Category and forum names in two languages

Post by dellsystem »

Hi,

There have been a few requests for this sort of feature, but I've never been able to find a released MOD to accomplish this. However, I found a post here that suggests a simple workaround that should be fine for your needs, assuming you only want Polish and English. It's not going to work exactly, since some changes have been made to phpBB since it was posted. You can find a version of the instructions that have been modified to fit your use case below. Please back up your database and your files before attempting this.

1. Add this to the bottom of includes/functions.php:

Code: Select all

function get_text_for_language($input, $lang)
{
	$tmp = explode('#', $input);
	$i = ($lang == 'pl') ? 0 : 1;
	return $tmp[$i];
}
Note that this assumes that you want users who don't have a language specified to see English. If you would prefer them to see Polish instead, simply replace the 'pl' with 'en-gb' or 'en-us' (whichever version of English you have installed) and switch the 0 and the 1.

2. In any file that outputs FORUM_NAME to the template, in the following sort of format (though possibly slightly different):

Code: Select all

'FORUM_NAME' => $row['forum_name'],
change it to the following:

Code: Select all

'FORUM_NAME' => get_text_for_language($row['forum_name'], $user->data['user_lang']),
where $user needs to be a global variable. If you have problems with this step, let me know and I can identify the exact files and locations that need to be edited. One such file is includes/functions_display.php, so if you make the change in that file you should be able to see it working in some places.

3. Convert all your forum names to use the format "Informacje#Information" (Polish first). Note that there is a maximum of 255 characters for the entire string.

If there's enough interest in this I could turn this into an actual MOD. Let me know if this would be useful to you.
Former moderator and website team member | My MODs, and more (GitHub)
Najd D
Registered User
Posts: 22
Joined: Sun Jan 19, 2014 11:27 pm

Re: Category and forum names in two languages

Post by Najd D »

This is awesome ! great for multi lang forums ! u should turn it into a mod buddy :D
I didnt do it tho coz i think im using latest phpbb and a commercial template and this will be hard without a step by step guide even tho im looking for this solution for a month already !

best regards and 2 thumbs up
raminr1363
Registered User
Posts: 99
Joined: Sun Sep 29, 2013 7:16 pm

Re: Category and forum names in two languages

Post by raminr1363 »

@dellsystem Thank you.

Pleas can you make a mod for this?!!
also its be great if you make for both "FORUM_NAME" & "FORUM_DESC".

Thank you
User avatar
Vogelek23
Registered User
Posts: 64
Joined: Tue Aug 17, 2010 7:30 pm
Location: West Midlands, UK
Name: Lukas
Contact:

Re: Category and forum names in two languages

Post by Vogelek23 »

raminr1363 wrote:Pleas can you make a mod for this?!!
Next time, please use SEARCH: viewtopic.php?f=70&t=2231436
Professional computer repair forum.
The largest documentation database in Europe.
FREE and professional advice from over 70k users.
Earn money for activity!
https://www.elvikom.pl
Locked

Return to “[3.0.x] MOD Requests”